1 | <?php |
||
23 | class ProfilerTest extends BaseTestCase |
||
24 | { |
||
25 | /** @var DebugStack */ |
||
26 | private $logger; |
||
27 | /** @var \Twig_Environment */ |
||
28 | private $twig; |
||
29 | /** @var DoctrineDataCollector */ |
||
30 | private $collector; |
||
31 | |||
32 | public function setUp() |
||
33 | { |
||
34 | $this->logger = new DebugStack(); |
||
35 | $registry = $this->getMockBuilder(ManagerRegistry::class)->getMock(); |
||
36 | $registry->expects($this->once())->method('getManagers')->willReturn([]); |
||
37 | $this->collector = new DoctrineDataCollector($registry); |
||
|
|||
38 | $this->collector->addLogger('foo', $this->logger); |
||
39 | |||
40 | $twigLoaderFilesystem = new \Twig_Loader_Filesystem(__DIR__.'/../Resources/views/Collector'); |
||
41 | $twigLoaderFilesystem->addPath(__DIR__.'/../vendor/symfony/web-profiler-bundle/Resources/views', 'WebProfiler'); |
||
42 | $this->twig = new \Twig_Environment($twigLoaderFilesystem, ['debug' => true, 'strict_variables' => true]); |
||
43 | |||
44 | $this->twig->addExtension(new CodeExtension('', '', '')); |
||
45 | $this->twig->addExtension(new RoutingExtension($this->getMockBuilder(UrlGeneratorInterface::class)->getMock())); |
||
46 | $this->twig->addExtension(new HttpKernelExtension($this->getMockBuilder(FragmentHandler::class)->disableOriginalConstructor()->getMock())); |
||
47 | $this->twig->addExtension(new WebProfilerExtension()); |
||
48 | $this->twig->addExtension(new DoctrineExtension()); |
||
49 | |||
50 | $loader = $this->getMockBuilder(\Twig_RuntimeLoaderInterface::class)->getMock(); |
||
51 | $loader->method('load')->willReturn($this->getMockBuilder(HttpKernelRuntime::class)->disableOriginalConstructor()->getMock()); |
||
52 | $this->twig->addRuntimeLoader($loader); |
||
53 | } |
||
54 | |||
55 | public function testRender() |
||
86 | } |
||
87 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: