Skip to content

Commit 2814f47

Browse files
authored
Make tests green with Symfony 4.1 (#1986)
* Symfony 4.1: Fix the failing Behat test * Symfony 4.1: Fix deprecations
1 parent e0e639e commit 2814f47

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

features/bootstrap/JsonContext.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Behatch\Context\JsonContext as BaseJsonContext;
1616
use Behatch\HttpCall\HttpCallResultPool;
1717
use Behatch\Json\Json;
18+
use PHPUnit\Framework\Assert;
1819

1920
final class JsonContext extends BaseJsonContext
2021
{
@@ -65,4 +66,13 @@ public function theJsonShouldBeDeepEqualTo(PyStringNode $content)
6566
"The json is equal to:\n".$actual->encode()
6667
);
6768
}
69+
70+
/**
71+
* @Then /^the JSON should be a superset of:$/
72+
*/
73+
public function theJsonIsASupersetOf(PyStringNode $content)
74+
{
75+
$actual = json_decode($this->httpCallResultPool->getResult()->getValue(), true);
76+
Assert::assertArraySubset(json_decode($content->getRaw(), true), $actual);
77+
}
6878
}

features/jsonld/context.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Feature: JSON-LD contexts generation
1818
Then the response status code should be 200
1919
And the response should be in JSON
2020
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
21-
And the JSON should be equal to:
21+
And the JSON should be a superset of:
2222
"""
2323
{
2424
"@context": {

tests/Fixtures/app/AppKernel.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use Symfony\Component\HttpKernel\Kernel;
2828
use Symfony\Component\Routing\RouteCollectionBuilder;
2929
use Symfony\Component\Security\Core\User\UserInterface;
30-
use Symfony\Component\Security\Http\Firewall\ContextListener;
3130

3231
/**
3332
* AppKernel for tests.
@@ -119,9 +118,6 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
119118
],
120119
];
121120

122-
if (method_exists(ContextListener::class, 'setLogoutOnUserChange')) {
123-
$securityConfig['firewalls']['default']['logout_on_user_change'] = true;
124-
}
125121
$c->loadFromExtension('security', $securityConfig);
126122

127123
if ($_SERVER['LEGACY'] ?? true) {

tests/Fixtures/app/config/config_test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ doctrine:
2323
auto_generate_proxy_classes: '%kernel.debug%'
2424
auto_mapping: true
2525

26+
twig:
27+
strict_variables: '%kernel.debug%'
28+
2629
api_platform:
2730
title: 'My Dummy API'
2831
description: 'This is a test API.'

tests/Fixtures/app/config/routing.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
api:
22
resource: '.'
3-
type: 'api_platform'
3+
type: 'api_platform'
44

55
relation_embedded.custom_get:
6-
path: '/relation_embedders/{id}/custom'
7-
methods: ['GET', 'HEAD']
6+
path: '/relation_embedders/{id}/custom'
7+
methods: ['GET', 'HEAD']
88
defaults:
9-
_controller: 'TestBundle:Custom:custom'
9+
_controller: 'ApiPlatform\Core\Tests\Fixtures\TestBundle\Controller\CustomController::customAction'
1010

1111
controller:
1212
resource: '@TestBundle/Controller'
13-
type: annotation
13+
type: annotation

0 commit comments

Comments
 (0)