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 ;
@@ -114,7 +115,7 @@ public function testClassCacheIsNotLoadedWhenKernelIsNotBooted()
114115
115116 public function testEnvParametersResourceIsAdded ()
116117 {
117- $ container = $ this -> getMock ( ' Symfony\Component\DependencyInjection\ ContainerBuilder' );
118+ $ container = new ContainerBuilder ( );
118119 $ kernel = $ this ->getMockBuilder ('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest ' )
119120 ->disableOriginalConstructor ()
120121 ->setMethods (array ('getContainerBuilder ' , 'prepareContainer ' , 'getCacheDir ' , 'getLogDir ' ))
@@ -131,14 +132,21 @@ public function testEnvParametersResourceIsAdded()
131132 $ kernel ->expects ($ this ->any ())
132133 ->method ('getLogDir ' )
133134 ->will ($ this ->returnValue (sys_get_temp_dir ()));
134- $ container ->expects ($ this ->once ())
135- ->method ('addResource ' )
136- ->with (new EnvParametersResource ('SYMFONY__ ' ));
137135
138136 $ reflection = new \ReflectionClass (get_class ($ kernel ));
139137 $ method = $ reflection ->getMethod ('buildContainer ' );
140138 $ method ->setAccessible (true );
141139 $ method ->invoke ($ kernel );
140+
141+ $ found = false ;
142+ foreach ($ container ->getResources () as $ resource ) {
143+ if ($ resource instanceof EnvParametersResource) {
144+ $ found = true ;
145+ break ;
146+ }
147+ }
148+
149+ $ this ->assertTrue ($ found );
142150 }
143151
144152 public function testBootKernelSeveralTimesOnlyInitializesBundlesOnce ()
0 commit comments