[FrameworkBundle] removed the need to boot a Kernel in a unit test file

This commit is contained in:
Fabien Potencier 2011-04-21 21:49:05 +02:00
parent 813627bd4c
commit 4dc5b8ec78

View File

@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Bundle\FrameworkBundle\Tests\Kernel;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
@ -22,9 +21,18 @@ class TemplateNameParserTest extends TestCase
protected function setUp()
{
$kernel = new Kernel();
$kernel->boot();
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
$kernel
->expects($this->any())
->method('getBundle')
->will($this->returnCallback(function ($bundle) {
if (in_array($bundle, array('SensioFooBundle', 'SensioCmsFooBundle', 'FooBundle'))) {
return true;
}
throw new \InvalidArgumentException();
}))
;
$this->parser = new TemplateNameParser($kernel);
}