2222use Symfony \Component \EventDispatcher \EventDispatcher ;
2323use Symfony \Component \HttpKernel \DataCollector \DumpDataCollector ;
2424use Symfony \Component \HttpKernel \KernelInterface ;
25+ use Symfony \Component \HttpKernel \Profiler \Profiler ;
26+ use Symfony \Component \HttpKernel \Profiler \ProfilerStorageInterface ;
27+ use Symfony \Component \Routing \RouterInterface ;
2528
2629class WebProfilerExtensionTest extends TestCase
2730{
@@ -55,11 +58,15 @@ protected function setUp(): void
5558
5659 $ this ->kernel = $ this ->createMock (KernelInterface::class);
5760
61+ $ profiler = $ this ->createMock (Profiler::class);
62+ $ profilerStorage = $ this ->createMock (ProfilerStorageInterface::class);
63+ $ router = $ this ->createMock (RouterInterface::class);
64+
5865 $ this ->container = new ContainerBuilder ();
5966 $ this ->container ->register ('data_collector.dump ' , DumpDataCollector::class)->setPublic (true );
6067 $ this ->container ->register ('error_handler.error_renderer.html ' , HtmlErrorRenderer::class)->setPublic (true );
6168 $ this ->container ->register ('event_dispatcher ' , EventDispatcher::class)->setPublic (true );
62- $ this ->container ->register ('router ' , $ this -> getMockClass ( ' Symfony \\ Component \\ Routing \\ RouterInterface ' ))->setPublic (true );
69+ $ this ->container ->register ('router ' , \get_class ( $ router ))->setPublic (true );
6370 $ this ->container ->register ('twig ' , 'Twig\Environment ' )->setPublic (true );
6471 $ this ->container ->register ('twig_loader ' , 'Twig\Loader\ArrayLoader ' )->addArgument ([])->setPublic (true );
6572 $ this ->container ->register ('twig ' , 'Twig\Environment ' )->addArgument (new Reference ('twig_loader ' ))->setPublic (true );
@@ -71,9 +78,9 @@ protected function setUp(): void
7178 $ this ->container ->setParameter ('kernel.charset ' , 'UTF-8 ' );
7279 $ this ->container ->setParameter ('debug.file_link_format ' , null );
7380 $ this ->container ->setParameter ('profiler.class ' , ['Symfony \\Component \\HttpKernel \\Profiler \\Profiler ' ]);
74- $ this ->container ->register ('profiler ' , $ this -> getMockClass ( ' Symfony \\ Component \\ HttpKernel \\ Profiler \\ Profiler ' ))
81+ $ this ->container ->register ('profiler ' , \get_class ( $ profiler ))
7582 ->setPublic (true )
76- ->addArgument (new Definition ($ this -> getMockClass ( ' Symfony \\ Component \\ HttpKernel \\ Profiler \\ ProfilerStorageInterface ' )));
83+ ->addArgument (new Definition (\get_class ( $ profilerStorage )));
7784 $ this ->container ->setParameter ('data_collector.templates ' , []);
7885 $ this ->container ->set ('kernel ' , $ this ->kernel );
7986 $ this ->container ->addCompilerPass (new RegisterListenersPass ());
0 commit comments