[WebProfilerBundle] Fix TemplateManager test
This commit is contained in:
parent
ebda9d1ae7
commit
d1ed9685e1
@ -16,7 +16,6 @@ use Symfony\Bundle\WebProfilerBundle\Tests\TestCase;
|
|||||||
use Symfony\Component\HttpKernel\Profiler\Profile;
|
use Symfony\Component\HttpKernel\Profiler\Profile;
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
use Twig\Loader\LoaderInterface;
|
use Twig\Loader\LoaderInterface;
|
||||||
use Twig\Loader\SourceContextLoaderInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for TemplateManager class.
|
* Test for TemplateManager class.
|
||||||
@ -103,11 +102,14 @@ class TemplateManagerTest extends TestCase
|
|||||||
|
|
||||||
protected function mockTwigEnvironment()
|
protected function mockTwigEnvironment()
|
||||||
{
|
{
|
||||||
$loader = $this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock();
|
|
||||||
$loader->method('getSourceContext')->willReturn(new Source('source-code', 'source-name'));
|
|
||||||
$loader->method('exists')->willReturn(true);
|
|
||||||
|
|
||||||
$this->twigEnvironment = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock();
|
$this->twigEnvironment = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock();
|
||||||
|
|
||||||
|
$loader = $this->createMock(LoaderInterface::class);
|
||||||
|
$loader
|
||||||
|
->expects($this->any())
|
||||||
|
->method('exists')
|
||||||
|
->willReturn(true);
|
||||||
|
|
||||||
$this->twigEnvironment->expects($this->any())->method('getLoader')->willReturn($loader);
|
$this->twigEnvironment->expects($this->any())->method('getLoader')->willReturn($loader);
|
||||||
|
|
||||||
return $this->twigEnvironment;
|
return $this->twigEnvironment;
|
||||||
@ -130,7 +132,7 @@ class ProfileDummy extends Profile
|
|||||||
parent::__construct('token');
|
parent::__construct('token');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasCollector($name): bool
|
public function hasCollector(string $name): bool
|
||||||
{
|
{
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
case 'foo':
|
case 'foo':
|
||||||
|
Reference in New Issue
Block a user