Skip to content

Commit dc658e5

Browse files
authored
Merge pull request #1510 from dunglas/fix_3.4
Make tests green when using SF 3.4
2 parents 25e2526 + 12067f3 commit dc658e5

File tree

9 files changed

+30
-8
lines changed

9 files changed

+30
-8
lines changed

.travis.yml

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

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

composer.json

Lines changed: 2 additions & 2 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",
@@ -49,7 +49,7 @@
4949
"symfony/config": "^3.3 || ^4.0",
5050
"symfony/console": "^3.3 || ^4.0",
5151
"symfony/debug": "^2.8 || ^3.0 || ^4.0",
52-
"symfony/dependency-injection": "^3.3 || ^4.0",
52+
"symfony/dependency-injection": "^3.3@dev || ^4.0@dev",
5353
"symfony/doctrine-bridge": "^2.8 || ^3.0 || ^4.0",
5454
"symfony/event-dispatcher": "^3.3 || ^4.0",
5555
"symfony/expression-language": "^2.8 || ^3.0 || ^4.0",

features/bootstrap/FeatureContext.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\UuidIdentifierDummy;
4343
use Behat\Behat\Context\Context;
4444
use Behat\Behat\Context\SnippetAcceptingContext;
45+
use Behat\Behat\Hook\Scope\AfterStepScope;
4546
use Behatch\HttpCall\Request;
4647
use Doctrine\Common\Persistence\ManagerRegistry;
4748
use Doctrine\ORM\EntityManagerInterface;
@@ -77,12 +78,24 @@ public function __construct(ManagerRegistry $doctrine, Request $request)
7778
$this->request = $request;
7879
}
7980

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

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
@@ -143,6 +143,7 @@ services:
143143
app.config_dummy_resource.action:
144144
class: 'ApiPlatform\Core\Tests\Fixtures\TestBundle\Action\ConfigCustom'
145145
arguments: ['@api_platform.item_data_provider']
146+
public: true
146147

147148
app.entity.filter.dummy_car:
148149
parent: 'api_platform.doctrine.orm.search_filter'
@@ -198,6 +199,10 @@ services:
198199
api_platform.http_cache.purger:
199200
class: ApiPlatform\Core\Tests\Fixtures\NullPurger
200201

202+
test.api_platform.http_cache.purger:
203+
alias: api_platform.http_cache.purger
204+
public: true
205+
201206
test.property_accessor:
202207
alias: property_accessor
203208
public: true

0 commit comments

Comments
 (0)