Skip to content

Commit e52e53b

Browse files
committed
Merge branch '2.3' into 2.5
* 2.3: [HttpKernel] fixed tests
2 parents 9eb5c87 + 48eea91 commit e52e53b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Tests/KernelTest.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\HttpKernel\Tests;
1313

14+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1415
use Symfony\Component\HttpKernel\Config\EnvParametersResource;
1516
use Symfony\Component\HttpKernel\Kernel;
1617
use 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

Comments
 (0)