@@ -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