Skip to content

Commit c8e5665

Browse files
committed
Fix tests failures
1 parent ea25858 commit c8e5665

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

Tests/PhpUnit/AbstractExtensionTestCaseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function if_definition_does_not_have_argument_it_fails()
153153
{
154154
$this->load();
155155

156-
$this->setExpectedException('\PHPUnit_Framework_ExpectationFailedException', 10);
156+
$this->setExpectedException('\PHPUnit_Framework_ExpectationFailedException', '10');
157157

158158
$this->assertContainerBuilderHasServiceDefinitionWithArgument('manual_service_id', 10, 'any value');
159159
}

Tests/PhpUnit/ContainerHasParameterConstraintTest.php

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,17 @@ public function containerBuilderProvider()
2929

3030
$parameterName = 'parameter_name';
3131
$parameterValue = 'some value';
32-
$containerWithParameter = $this->createMockContainerWithParameters(
33-
array(
34-
$parameterName => $parameterValue
35-
)
36-
);
37-
3832
$wrongParameterValue = 'some other value';
3933

4034
return array(
4135
// the container does not have the parameter
4236
array($emptyContainer, $parameterName, $parameterValue, true, false),
4337
// the container has the parameter but the values don't match
44-
array($containerWithParameter, $parameterName, $wrongParameterValue, true, false),
38+
array($this->createMockContainerWithParameters(array($parameterName => $parameterValue)), $parameterName, $wrongParameterValue, true, false),
4539
// the container has the parameter and the value matches
46-
array($containerWithParameter, $parameterName, $parameterValue, true, true),
40+
array($this->createMockContainerWithParameters(array($parameterName => $parameterValue)), $parameterName, $parameterValue, true, true),
4741
// the container has the parameter and the value is optional
48-
array($containerWithParameter, $parameterName, null, false, true),
42+
array($this->createMockContainerWithParameters(array($parameterName => $parameterValue)), $parameterName, null, false, true),
4943
);
5044
}
5145

@@ -56,24 +50,16 @@ private function createMockContainerWithParameters(array $parameters)
5650
$container
5751
->expects($this->any())
5852
->method('hasParameter')
59-
->will(
60-
$this->returnCallback(
61-
function ($parameterName) use ($parameters) {
62-
return array_key_exists($parameterName, $parameters);
63-
}
64-
)
65-
);
53+
->willReturnCallback(function ($parameterName) use ($parameters) {
54+
return array_key_exists($parameterName, $parameters);
55+
});
6656

6757
$container
6858
->expects($this->any())
6959
->method('getParameter')
70-
->will(
71-
$this->returnCallback(
72-
function ($parameterName) use ($parameters) {
73-
return $parameters[$parameterName];
74-
}
75-
)
76-
);
60+
->willReturnCallback(function ($parameterName) use ($parameters) {
61+
return $parameters[$parameterName];
62+
});
7763

7864
return $container;
7965
}

0 commit comments

Comments
 (0)