11
11
12
12
namespace Symfony \Component \HttpKernel \Tests ;
13
13
14
+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
14
15
use Symfony \Component \HttpKernel \Config \EnvParametersResource ;
15
16
use Symfony \Component \HttpKernel \Kernel ;
16
17
use Symfony \Component \HttpKernel \HttpKernelInterface ;
@@ -149,7 +150,7 @@ public function testClassCacheIsNotLoadedWhenKernelIsNotBooted()
149
150
150
151
public function testEnvParametersResourceIsAdded ()
151
152
{
152
- $ container = $ this -> getMock ( ' Symfony\Component\DependencyInjection\ ContainerBuilder' );
153
+ $ container = new ContainerBuilder ( );
153
154
$ kernel = $ this ->getMockBuilder ('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest ' )
154
155
->disableOriginalConstructor ()
155
156
->setMethods (array ('getContainerBuilder ' , 'prepareContainer ' , 'getCacheDir ' , 'getLogDir ' ))
@@ -166,14 +167,21 @@ public function testEnvParametersResourceIsAdded()
166
167
$ kernel ->expects ($ this ->any ())
167
168
->method ('getLogDir ' )
168
169
->will ($ this ->returnValue (sys_get_temp_dir ()));
169
- $ container ->expects ($ this ->once ())
170
- ->method ('addResource ' )
171
- ->with (new EnvParametersResource ('SYMFONY__ ' ));
172
170
173
171
$ reflection = new \ReflectionClass (get_class ($ kernel ));
174
172
$ method = $ reflection ->getMethod ('buildContainer ' );
175
173
$ method ->setAccessible (true );
176
174
$ 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 );
177
185
}
178
186
179
187
public function testBootKernelSeveralTimesOnlyInitializesBundlesOnce ()
0 commit comments