1111
1212namespace Symfony \Component \HttpKernel \Tests ;
1313
14+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
1415use Symfony \Component \HttpKernel \Config \EnvParametersResource ;
1516use Symfony \Component \HttpKernel \Kernel ;
1617use Symfony \Component \HttpKernel \HttpKernelInterface ;
@@ -149,7 +150,7 @@ public function testClassCacheIsNotLoadedWhenKernelIsNotBooted()
149150
150151 public function testEnvParametersResourceIsAdded ()
151152 {
152- $ container = $ this -> getMock ( ' Symfony\Component\DependencyInjection\ ContainerBuilder' );
153+ $ container = new ContainerBuilder ( );
153154 $ kernel = $ this ->getMockBuilder ('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest ' )
154155 ->disableOriginalConstructor ()
155156 ->setMethods (array ('getContainerBuilder ' , 'prepareContainer ' , 'getCacheDir ' , 'getLogDir ' ))
@@ -166,14 +167,21 @@ public function testEnvParametersResourceIsAdded()
166167 $ kernel ->expects ($ this ->any ())
167168 ->method ('getLogDir ' )
168169 ->will ($ this ->returnValue (sys_get_temp_dir ()));
169- $ container ->expects ($ this ->once ())
170- ->method ('addResource ' )
171- ->with (new EnvParametersResource ('SYMFONY__ ' ));
172170
173171 $ reflection = new \ReflectionClass (get_class ($ kernel ));
174172 $ method = $ reflection ->getMethod ('buildContainer ' );
175173 $ method ->setAccessible (true );
176174 $ method ->invoke ($ kernel );
175+
176+ $ found = false ;
177+ foreach ($ container ->getResources () as $ resource ) {
178+ if ($ resource instanceof EnvParametersResource) {
179+ $ found = true ;
180+ break ;
181+ }
182+ }
183+
184+ $ this ->assertTrue ($ found );
177185 }
178186
179187 public function testBootKernelSeveralTimesOnlyInitializesBundlesOnce ()
0 commit comments