22
22
use Symfony \Component \EventDispatcher \EventDispatcher ;
23
23
use Symfony \Component \HttpKernel \DataCollector \DumpDataCollector ;
24
24
use Symfony \Component \HttpKernel \KernelInterface ;
25
+ use Symfony \Component \HttpKernel \Profiler \Profiler ;
26
+ use Symfony \Component \HttpKernel \Profiler \ProfilerStorageInterface ;
27
+ use Symfony \Component \Routing \RouterInterface ;
25
28
26
29
class WebProfilerExtensionTest extends TestCase
27
30
{
@@ -55,11 +58,15 @@ protected function setUp(): void
55
58
56
59
$ this ->kernel = $ this ->createMock (KernelInterface::class);
57
60
61
+ $ profiler = $ this ->createMock (Profiler::class);
62
+ $ profilerStorage = $ this ->createMock (ProfilerStorageInterface::class);
63
+ $ router = $ this ->createMock (RouterInterface::class);
64
+
58
65
$ this ->container = new ContainerBuilder ();
59
66
$ this ->container ->register ('data_collector.dump ' , DumpDataCollector::class)->setPublic (true );
60
67
$ this ->container ->register ('error_handler.error_renderer.html ' , HtmlErrorRenderer::class)->setPublic (true );
61
68
$ 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 );
63
70
$ this ->container ->register ('twig ' , 'Twig\Environment ' )->setPublic (true );
64
71
$ this ->container ->register ('twig_loader ' , 'Twig\Loader\ArrayLoader ' )->addArgument ([])->setPublic (true );
65
72
$ this ->container ->register ('twig ' , 'Twig\Environment ' )->addArgument (new Reference ('twig_loader ' ))->setPublic (true );
@@ -71,9 +78,9 @@ protected function setUp(): void
71
78
$ this ->container ->setParameter ('kernel.charset ' , 'UTF-8 ' );
72
79
$ this ->container ->setParameter ('debug.file_link_format ' , null );
73
80
$ 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 ))
75
82
->setPublic (true )
76
- ->addArgument (new Definition ($ this -> getMockClass ( ' Symfony \\ Component \\ HttpKernel \\ Profiler \\ ProfilerStorageInterface ' )));
83
+ ->addArgument (new Definition (\get_class ( $ profilerStorage )));
77
84
$ this ->container ->setParameter ('data_collector.templates ' , []);
78
85
$ this ->container ->set ('kernel ' , $ this ->kernel );
79
86
$ this ->container ->addCompilerPass (new RegisterListenersPass ());
0 commit comments