[WebProfilerBundle] Fix TemplateManager test

This commit is contained in:
Thomas Calvet 2019-10-03 09:09:47 +02:00
parent ebda9d1ae7
commit d1ed9685e1
1 changed files with 8 additions and 6 deletions

View File

@ -16,7 +16,6 @@ use Symfony\Bundle\WebProfilerBundle\Tests\TestCase;
use Symfony\Component\HttpKernel\Profiler\Profile;
use Twig\Environment;
use Twig\Loader\LoaderInterface;
use Twig\Loader\SourceContextLoaderInterface;
/**
* Test for TemplateManager class.
@ -103,11 +102,14 @@ class TemplateManagerTest extends TestCase
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();
$loader = $this->createMock(LoaderInterface::class);
$loader
->expects($this->any())
->method('exists')
->willReturn(true);
$this->twigEnvironment->expects($this->any())->method('getLoader')->willReturn($loader);
return $this->twigEnvironment;
@ -130,7 +132,7 @@ class ProfileDummy extends Profile
parent::__construct('token');
}
public function hasCollector($name): bool
public function hasCollector(string $name): bool
{
switch ($name) {
case 'foo':