Skip to content

Commit 51983d0

Browse files
committed
minor symfony#13516 [HttpKernel] fixed tests (fabpot)
This PR was merged into the 2.3 branch. Discussion ---------- [HttpKernel] fixed tests | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- a3f0299 [HttpKernel] fixed tests
2 parents 8892cf0 + a3f0299 commit 51983d0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/Symfony/Component/HttpKernel/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;
@@ -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

Comments
 (0)