Skip to content

Commit 3ac28ed

Browse files
authored
Fix failing test on CI (#45)
1 parent e6a9df4 commit 3ac28ed

10 files changed

+21
-20
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ php:
44
- '7.1'
55
- '7.2'
66
- '7.3'
7+
- '7.4'
78

89
env:
910
global:
@@ -25,7 +26,7 @@ before_install:
2526
- phpenv config-rm xdebug.ini || true
2627

2728
install:
28-
- composer require symfony/http-foundation:$SYMFONY_VERSION symfony/http-kernel:$SYMFONY_VERSION symfony/config:$SYMFONY_VERSION symfony/dependency-injection:$SYMFONY_VERSION
29+
- composer require symfony/http-foundation:$SYMFONY_VERSION symfony/http-kernel:$SYMFONY_VERSION symfony/config:$SYMFONY_VERSION symfony/dependency-injection:$SYMFONY_VERSION symfony/routing:$SYMFONY_VERSION
2930
- make build
3031
script:
3132
- make test-technical

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"behat/behat": "~3.0",
4343
"squizlabs/php_codesniffer": "3.*",
4444
"phpunit/phpunit": "^7.0 || ^8.0",
45-
"matthiasnoback/symfony-dependency-injection-test": "^2.0 || ^3.0",
45+
"matthiasnoback/symfony-dependency-injection-test": "^3.0 || ^4.0",
4646
"matthiasnoback/symfony-config-test": "^3.0 || ^4.0",
4747
"symfony/framework-bundle": "^3.0 || ^4.0",
4848
"symfony/http-kernel": "^3.0 || ^4.0",

tests/Common/DependencyInjection/AbstractTestClass.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ abstract class AbstractTestClass extends AbstractExtensionTestCase
2222
/**
2323
* {@inheritdoc}
2424
*/
25-
protected function getContainerExtensions()
25+
protected function getContainerExtensions(): array
2626
{
2727
return [
2828
new JsonRpcHttpServerExtension()
2929
];
3030
}
3131

32-
protected function load(array $configurationValues = [], $mockResolver = true, $compile = true)
32+
protected function loadContainer(array $configurationValues = [], $mockResolver = true, $compile = true): void
3333
{
3434
// Inject event dispatcher
3535
$this->setDefinition('event_dispatcher', new Definition(EventDispatcher::class));

tests/Functional/DependencyInjection/ConfigFilesTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ConfigFilesTest extends AbstractTestClass
2626
/**
2727
* {@inheritdoc}
2828
*/
29-
protected function getContainerExtensions()
29+
protected function getContainerExtensions(): array
3030
{
3131
return [
3232
new JsonRpcHttpServerExtension()
@@ -44,7 +44,7 @@ protected function getContainerExtensions()
4444
*/
4545
public function testShouldHaveService($serviceId, $expectedClassName, $public)
4646
{
47-
$this->load([], true, false);
47+
$this->loadContainer([], true, false);
4848

4949
$this->assertContainerBuilderHasService($serviceId, $expectedClassName);
5050
if (true === $public) {

tests/Functional/DependencyInjection/JsonRpcHttpServerExtensionTest.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class JsonRpcHttpServerExtensionTest extends AbstractTestClass
1919
/**
2020
* {@inheritdoc}
2121
*/
22-
protected function getContainerExtensions()
22+
protected function getContainerExtensions(): array
2323
{
2424
return [
2525
new JsonRpcHttpServerExtension()
@@ -29,15 +29,15 @@ protected function getContainerExtensions()
2929

3030
public function testShouldBeLoadable()
3131
{
32-
$this->load();
32+
$this->loadContainer();
3333

3434
$this->assertEndpointIsUsable();
3535
}
3636

3737
public function testShouldManageCustomEndpointPathFromConfiguration()
3838
{
3939
$myCustomEndpoint = 'my-custom-endpoint';
40-
$this->load(['endpoint' => $myCustomEndpoint]);
40+
$this->loadContainer(['endpoint' => $myCustomEndpoint]);
4141

4242
// Assert custom resolver is an alias of the stub
4343
$this->assertContainerBuilderHasParameter(self::EXPECTED_HTTP_ENDPOINT_PATH_CONTAINER_PARAM, $myCustomEndpoint);
@@ -57,7 +57,7 @@ public function testShouldBindServerDispatcherToDispatcherAwareService()
5757

5858
$this->setDefinition('my-dispatcher-aware-service', $dispatcherAwareServiceDefinition);
5959

60-
$this->load();
60+
$this->loadContainer();
6161

6262
// Assert custom resolver is an alias of the stub
6363
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
@@ -85,7 +85,7 @@ public function testShouldThrowAnExceptionIfDispatcherAwareServiceDoesNotUseRigh
8585
.'"'.JsonRpcServerDispatcherAwareTrait::class.'"'
8686
);
8787

88-
$this->load();
88+
$this->loadContainer();
8989
}
9090

9191
public function testShouldInjectParamsValidatorAliasIfDefined()
@@ -96,7 +96,7 @@ public function testShouldInjectParamsValidatorAliasIfDefined()
9696
$this->setDefinition($myValidatorServiceId, $paramsValidator);
9797
$this->container->setAlias(self::EXPECTED_PARAMS_VALIDATOR_ALIAS, $myValidatorServiceId);
9898

99-
$this->load();
99+
$this->loadContainer();
100100

101101
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
102102
self::EXPECTED_REQUEST_HANDLER_SERVICE_ID,
@@ -109,7 +109,7 @@ public function testShouldInjectParamsValidatorAliasIfDefined()
109109

110110
public function testShouldNotInjectParamsValidatorAliasIfNotDefined()
111111
{
112-
$this->load();
112+
$this->loadContainer();
113113

114114
$handlerDefinition = $this->container->getDefinition(self::EXPECTED_REQUEST_HANDLER_SERVICE_ID);
115115
foreach ($handlerDefinition->getMethodCalls() as $methodCall) {
@@ -142,7 +142,7 @@ public function testShouldBindJsonRpcMethodsToMethodAwareServices()
142142
$methodAwareDefinition->addTag(JsonRpcHttpServerExtension::JSONRPC_METHOD_AWARE_TAG);
143143
$this->setDefinition($methodAwareServiceServiceId, $methodAwareDefinition);
144144

145-
$this->load();
145+
$this->loadContainer();
146146

147147
// Assert that method mapping have been correctly injected
148148
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
@@ -183,6 +183,6 @@ public function testShouldThowAnExceptionIfMethodAwareServiceDoesNotImplementRig
183183
JsonRpcMethodAwareInterface::class
184184
));
185185

186-
$this->load();
186+
$this->loadContainer();
187187
}
188188
}

tests/Functional/DependencyInjection/JsonRpcMethodDefinitionHelperTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class JsonRpcMethodDefinitionHelperTest extends AbstractTestClass
1414
/** @var JsonRpcMethodDefinitionHelper */
1515
private $helper;
1616

17-
public function setUp()
17+
public function setUp(): void
1818
{
1919
$this->helper = new JsonRpcMethodDefinitionHelper();
2020
parent::setUp();

tests/Functional/Dispatcher/SymfonyJsonRpcServerDispatcherTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class SymfonyJsonRpcServerDispatcherTest extends TestCase
2020
/** @var EventDispatcherInterface|ObjectProphecy */
2121
private $sfDispatcher;
2222

23-
protected function setUp()
23+
protected function setUp(): void
2424
{
2525
$this->sfDispatcher = $this->prophesize(EventDispatcherInterface::class);
2626
$this->dispatcher = new SymfonyJsonRpcServerDispatcher(

tests/Functional/Endpoint/JsonRpcHttpEndpointTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class JsonRpcHttpEndpointTest extends TestCase
1919
/** @var SdkJsonRpcEndpoint|ObjectProphecy */
2020
private $sdkEndpoint;
2121

22-
protected function setUp()
22+
protected function setUp(): void
2323
{
2424
$this->sdkEndpoint = $this->prophesize(SdkJsonRpcEndpoint::class);
2525

tests/Functional/Event/SymfonyJsonRpcServerEventTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class SymfonyJsonRpcServerEventTest extends TestCase
1616
/** @var SymfonyJsonRpcServerEvent */
1717
private $event;
1818

19-
protected function setUp()
19+
protected function setUp(): void
2020
{
2121
$this->jsonRpcServerEvent = $this->prophesize(JsonRpcServerEvent::class);
2222

tests/Functional/Resolver/MethodResolverTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MethodResolverTest extends TestCase
1818
/** @var ContainerInterface|ObjectProphecy */
1919
private $locator;
2020

21-
protected function setUp()
21+
protected function setUp(): void
2222
{
2323
$this->locator = $this->prophesize(ContainerInterface::class);
2424

0 commit comments

Comments
 (0)