Skip to content

Commit 1de76c2

Browse files
dunglasNightbr
authored andcommitted
Make tests green when using SF 3.4
1 parent d81664e commit 1de76c2

File tree

9 files changed

+31
-9
lines changed

9 files changed

+31
-9
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ install:
4040

4141
script:
4242
- vendor/bin/phpunit
43-
- vendor/bin/behat --format=progress
43+
- if [[ $deps = 'beta' ]]; then vendor/bin/behat --format=progress --tags='~@nobeta'; fi
44+
- if [[ $deps != 'beta' ]]; then vendor/bin/behat --format=progress; fi
4445
- tests/Fixtures/app/console api:swagger:export > swagger.json && swagger-cli validate swagger.json && rm swagger.json
4546
- if [[ $lint = 1 ]]; then php php-cs-fixer.phar fix --dry-run --diff --no-ansi; fi
4647
- if [[ $lint = 1 ]]; then phpstan analyse -c phpstan.neon -l5 --ansi src tests; fi

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"behat/mink-browserkit-driver": "^1.3.1",
3232
"behat/mink-extension": "^2.2",
3333
"behat/symfony2-extension": "^2.1.1",
34-
"behatch/contexts": "^2.6",
34+
"behatch/contexts": "dev-master",
3535
"doctrine/doctrine-bundle": "^1.6.3",
3636
"doctrine/orm": "^2.5.2",
3737
"doctrine/annotations": "^1.2",
@@ -50,8 +50,8 @@
5050
"symfony/config": "^3.3 || ^4.0",
5151
"symfony/console": "^3.3 || ^4.0",
5252
"symfony/debug": "^2.8 || ^3.0 || ^4.0",
53-
"symfony/dependency-injection": "^3.3 || ^4.0",
54-
"symfony/doctrine-bridge": "^2.8.12 || ^3.0 || ^4.0",
53+
"symfony/dependency-injection": "^3.3@dev || ^4.0@dev",
54+
"symfony/doctrine-bridge": "^2.8 || ^3.0 || ^4.0",
5555
"symfony/event-dispatcher": "^3.3 || ^4.0",
5656
"symfony/expression-language": "^2.8 || ^3.0 || ^4.0",
5757
"symfony/finder": "^3.3 || ^4.0",

features/bootstrap/FeatureContext.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\UuidIdentifierDummy;
4545
use Behat\Behat\Context\Context;
4646
use Behat\Behat\Context\SnippetAcceptingContext;
47+
use Behat\Behat\Hook\Scope\AfterStepScope;
4748
use Behatch\HttpCall\Request;
4849
use Doctrine\Common\Persistence\ManagerRegistry;
4950
use Doctrine\ORM\EntityManagerInterface;
@@ -79,12 +80,24 @@ public function __construct(ManagerRegistry $doctrine, Request $request)
7980
$this->request = $request;
8081
}
8182

83+
/**
84+
* Sets the default Accept HTTP header to null (workaround to artificially remove it).
85+
*
86+
* @AfterStep
87+
*/
88+
public function removeAcceptHeaderAfterRequest(AfterStepScope $event)
89+
{
90+
if (preg_match('/^I send a "[A-Z]+" request to ".+"/', $event->getStep()->getText())) {
91+
$this->request->setHttpHeader('Accept', null);
92+
}
93+
}
94+
8295
/**
8396
* Sets the default Accept HTTP header to null (workaround to artificially remove it).
8497
*
8598
* @BeforeScenario
8699
*/
87-
public function removeAcceptHeader()
100+
public function removeAcceptHeaderBeforeScenario()
88101
{
89102
$this->request->setHttpHeader('Accept', null);
90103
}

features/bootstrap/HttpCacheContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function setKernel(KernelInterface $kernel)
3535
*/
3636
public function irisShouldBePurged(string $iris)
3737
{
38-
$purger = $this->kernel->getContainer()->get('api_platform.http_cache.purger');
38+
$purger = $this->kernel->getContainer()->get('test.api_platform.http_cache.purger');
3939

4040
$purgedIris = implode(',', $purger->getIris());
4141
$purger->clear();

features/doctrine/boolean_filter.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Feature: Boolean filter on collections
371371
And the JSON node "hydra:totalItems" should be equal to 15
372372

373373
@dropSchema
374-
Scenario: Get collection ordered by a non valid properties
374+
Scenario: Get collection filtered by non valid properties
375375
When I send a "GET" request to "/dummies?unknown=0"
376376
Then the response status code should be 200
377377
And the response should be in JSON

features/http_cache/tags.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Feature: Cache invalidation through HTTP Cache tags
6969
{
7070
}
7171
"""
72+
When I add "Content-Type" header equal to "application/ld+json"
7273
And I send a "POST" request to "/relation2s" with body:
7374
"""
7475
{

features/integration/nelmio_api_doc.feature

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
@nobeta
2+
# Skip while NelmioApiDoc 2 isn't compatible with Symfony 3.4
13
Feature: NelmioApiDoc integration
24
In order to use NelmioApiDocBundle
35
As an API software developer
46
I need to see the generated documentation
57

6-
Scenario: Create a user
8+
Scenario: Test if the NelmioApiDoc integration works
79
When I send a "GET" request to "/nelmioapidoc"
810
Then the response status code should be 200
911
And I should see text matching "AbstractDummy"

features/main/configurable.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Feature: Configurable resource CRUD
22
As a client software developer
3-
I need to be able to configure api resources through Yaml
3+
I need to be able to configure api resources through YAML
44

55
@createSchema
66
Scenario: Retrieve the ConfigDummy resource

tests/Fixtures/app/config/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ services:
163163
app.config_dummy_resource.action:
164164
class: 'ApiPlatform\Core\Tests\Fixtures\TestBundle\Action\ConfigCustom'
165165
arguments: ['@api_platform.item_data_provider']
166+
public: true
166167

167168
app.entity.filter.dummy_property.property:
168169
parent: 'api_platform.serializer.property_filter'
@@ -213,6 +214,10 @@ services:
213214
api_platform.http_cache.purger:
214215
class: ApiPlatform\Core\Tests\Fixtures\NullPurger
215216

217+
test.api_platform.http_cache.purger:
218+
alias: api_platform.http_cache.purger
219+
public: true
220+
216221
test.property_accessor:
217222
alias: property_accessor
218223
public: true

0 commit comments

Comments
 (0)