Skip to content

Commit 29e6490

Browse files
authored
Fix tests (#1519)
* Fix tests * fix cs
1 parent 2b17756 commit 29e6490

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

features/bootstrap/FeatureContext.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\UuidIdentifierDummy;
2727
use Behat\Behat\Context\Context;
2828
use Behat\Behat\Context\SnippetAcceptingContext;
29+
use Behat\Behat\Hook\Scope\AfterStepScope;
2930
use Behatch\HttpCall\Request;
3031
use Doctrine\Common\Persistence\ManagerRegistry;
3132
use Doctrine\ORM\EntityManagerInterface;
@@ -61,12 +62,24 @@ public function __construct(ManagerRegistry $doctrine, Request $request)
6162
$this->request = $request;
6263
}
6364

65+
/**
66+
* Sets the default Accept HTTP header to null (workaround to artificially remove it).
67+
*
68+
* @AfterStep
69+
*/
70+
public function removeAcceptHeaderAfterRequest(AfterStepScope $event)
71+
{
72+
if (preg_match('/^I send a "[A-Z]+" request to ".+"/', $event->getStep()->getText())) {
73+
$this->request->setHttpHeader('Accept', null);
74+
}
75+
}
76+
6477
/**
6578
* Sets the default Accept HTTP header to null (workaround to artificially remove it).
6679
*
6780
* @BeforeScenario
6881
*/
69-
public function removeAcceptHeader()
82+
public function removeAcceptHeaderBeforeScenario()
7083
{
7184
$this->request->setHttpHeader('Accept', null);
7285
}

features/doctrine/boolean_filter.feature

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

169169
@dropSchema
170-
Scenario: Get collection ordered by a non valid properties
170+
Scenario: Get collection filtered by non valid properties
171171
When I send a "GET" request to "/dummies?unknown=0"
172172
Then the response status code should be 200
173173
And the response should be in JSON

0 commit comments

Comments
 (0)