From d1ed9685e168f791051e5cf92c40f4ce7c91d7bf Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Thu, 3 Oct 2019 09:09:47 +0200 Subject: [PATCH] [WebProfilerBundle] Fix TemplateManager test --- .../Tests/Profiler/TemplateManagerTest.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php index 3994648339..005ce9e434 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php @@ -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':