This repository was archived by the owner on Apr 29, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
spec/Behat/Symfony2Extension/Context/Argument
src/Behat/Symfony2Extension/Context/Argument Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class ServiceArgumentResolverSpec extends ObjectBehavior
14
14
function let (KernelInterface $ kernel , ContainerInterface $ container )
15
15
{
16
16
$ kernel ->getContainer ()->willReturn ($ container );
17
+ $ container ->has ('test.service_container ' )->willReturn (false );
17
18
18
19
$ this ->beConstructedWith ($ kernel );
19
20
}
@@ -150,4 +151,20 @@ function it_resolves_arrays_of_strings_starting_with_at_sign(
150
151
array ('array ' => array ($ service1 , $ service2 ))
151
152
);
152
153
}
154
+
155
+ function it_uses_the_test_service_container (
156
+ ReflectionClass $ reflectionClass ,
157
+ ContainerInterface $ container ,
158
+ ContainerInterface $ testContainer
159
+ ) {
160
+ $ testContainer ->getParameter ('parameter ' )->willReturn ('param_value ' );
161
+ $ testContainer ->hasParameter ('parameter ' )->willReturn (true );
162
+
163
+ $ container ->has ('test.service_container ' )->willReturn (true );
164
+ $ container ->get ('test.service_container ' )->willReturn ($ testContainer );
165
+
166
+ $ this ->resolveArguments ($ reflectionClass , array ('parameter ' => '%parameter% ' ))->shouldReturn (
167
+ array ('parameter ' => 'param_value ' )
168
+ );
169
+ }
153
170
}
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ private function resolveArgument($argument)
70
70
}
71
71
72
72
$ container = $ this ->kernel ->getContainer ();
73
+ $ container = $ container ->has ('test.service_container ' ) ? $ container ->get ('test.service_container ' ) : $ container ;
73
74
74
75
if ($ service = $ this ->getService ($ container , $ argument )) {
75
76
return $ service ;
You can’t perform that action at this time.
0 commit comments