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 ;
@@ -114,7 +115,7 @@ public function testClassCacheIsNotLoadedWhenKernelIsNotBooted()
114
115
115
116
public function testEnvParametersResourceIsAdded ()
116
117
{
117
- $ container = $ this -> getMock ( ' Symfony\Component\DependencyInjection\ ContainerBuilder' );
118
+ $ container = new ContainerBuilder ( );
118
119
$ kernel = $ this ->getMockBuilder ('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest ' )
119
120
->disableOriginalConstructor ()
120
121
->setMethods (array ('getContainerBuilder ' , 'prepareContainer ' , 'getCacheDir ' , 'getLogDir ' ))
@@ -131,14 +132,21 @@ public function testEnvParametersResourceIsAdded()
131
132
$ kernel ->expects ($ this ->any ())
132
133
->method ('getLogDir ' )
133
134
->will ($ this ->returnValue (sys_get_temp_dir ()));
134
- $ container ->expects ($ this ->once ())
135
- ->method ('addResource ' )
136
- ->with (new EnvParametersResource ('SYMFONY__ ' ));
137
135
138
136
$ reflection = new \ReflectionClass (get_class ($ kernel ));
139
137
$ method = $ reflection ->getMethod ('buildContainer ' );
140
138
$ method ->setAccessible (true );
141
139
$ 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 );
142
150
}
143
151
144
152
public function testBootKernelSeveralTimesOnlyInitializesBundlesOnce ()
0 commit comments