Skip to content

Commit 2f7c509

Browse files
committed
replace usages of the deprecated PHPUnit getMockClass() method
1 parent 067a8a7 commit 2f7c509

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
use Symfony\Component\EventDispatcher\EventDispatcher;
2323
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
2424
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;
2528

2629
class 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

Comments
 (0)