[FrameworkBundle] removed the need to boot a Kernel in a unit test file
This commit is contained in:
parent
813627bd4c
commit
4dc5b8ec78
@ -12,7 +12,6 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\Kernel;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser;
|
use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser;
|
||||||
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
|
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
|
||||||
|
|
||||||
@ -22,9 +21,18 @@ class TemplateNameParserTest extends TestCase
|
|||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$kernel = new Kernel();
|
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
||||||
$kernel->boot();
|
$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);
|
$this->parser = new TemplateNameParser($kernel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user