minor #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
This commit is contained in:
Fabien Potencier 2015-01-25 06:24:12 +01:00
commit 51983d0583
1 changed files with 12 additions and 4 deletions

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\HttpKernel\Tests;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Config\EnvParametersResource;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\HttpKernelInterface;
@ -149,7 +150,7 @@ class KernelTest extends \PHPUnit_Framework_TestCase
public function testEnvParametersResourceIsAdded()
{
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
$container = new ContainerBuilder();
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest')
->disableOriginalConstructor()
->setMethods(array('getContainerBuilder', 'prepareContainer', 'getCacheDir', 'getLogDir'))
@ -166,14 +167,21 @@ class KernelTest extends \PHPUnit_Framework_TestCase
$kernel->expects($this->any())
->method('getLogDir')
->will($this->returnValue(sys_get_temp_dir()));
$container->expects($this->once())
->method('addResource')
->with(new EnvParametersResource('SYMFONY__'));
$reflection = new \ReflectionClass(get_class($kernel));
$method = $reflection->getMethod('buildContainer');
$method->setAccessible(true);
$method->invoke($kernel);
$found = false;
foreach ($container->getResources() as $resource) {
if ($resource instanceof EnvParametersResource) {
$found = true;
break;
}
}
$this->assertTrue($found);
}
public function testBootKernelSeveralTimesOnlyInitializesBundlesOnce()