Skip to content

Commit 0a9e391

Browse files
committed
fixed obsolete getMock() usage
1 parent 3f96468 commit 0a9e391

File tree

23 files changed

+68
-74
lines changed

23 files changed

+68
-74
lines changed

src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function testVerbosityMapping($verbosity, $level, $isHandling, array $map
5959
// check that the handler actually outputs the record if it handles it
6060
$levelName = Logger::getLevelName($level);
6161

62-
$realOutput = $this->getMock('Symfony\Component\Console\Output\Output', array('doWrite'));
62+
$realOutput = $this->getMockBuilder('Symfony\Component\Console\Output\Output')->setMethods(array('doWrite'))->getMock();
6363
$realOutput->setVerbosity($verbosity);
6464
$realOutput
6565
->expects($isHandling ? $this->once() : $this->never())

src/Symfony/Bridge/Twig/Tests/AppVariableTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ public function testGetRequest()
6969

7070
public function testGetToken()
7171
{
72-
$tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');
72+
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
7373
$this->appVariable->setTokenStorage($tokenStorage);
7474

75-
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
75+
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
7676
$tokenStorage->method('getToken')->willReturn($token);
7777

7878
$this->assertEquals($token, $this->appVariable->getToken());
@@ -94,7 +94,7 @@ public function testGetUserWithUsernameAsTokenUser()
9494

9595
public function testGetTokenWithNoToken()
9696
{
97-
$tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');
97+
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
9898
$this->appVariable->setTokenStorage($tokenStorage);
9999

100100
$this->assertNull($this->appVariable->getToken());

src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function testCustomDumper()
120120
'</pre><script>Sfdump("%s")</script>'
121121
);
122122
$extension = new DumpExtension(new VarCloner(), $dumper);
123-
$twig = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array(
123+
$twig = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array(
124124
'debug' => true,
125125
'cache' => false,
126126
'optimizations' => 0,

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function setUp()
4747
'bootstrap_3_horizontal_layout.html.twig',
4848
'custom_widgets.html.twig',
4949
), $environment);
50-
$this->renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
50+
$this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
5151
$this->registerTwigRuntimeLoader($environment, $this->renderer);
5252
}
5353

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function setUp()
4343
'bootstrap_3_layout.html.twig',
4444
'custom_widgets.html.twig',
4545
), $environment);
46-
$this->renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
46+
$this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
4747
$this->registerTwigRuntimeLoader($environment, $this->renderer);
4848
}
4949

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function setUp()
4747
'form_div_layout.html.twig',
4848
'custom_widgets.html.twig',
4949
), $environment);
50-
$this->renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
50+
$this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
5151
$this->registerTwigRuntimeLoader($environment, $this->renderer);
5252
}
5353

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function setUp()
4444
'form_table_layout.html.twig',
4545
'custom_widgets.html.twig',
4646
), $environment);
47-
$this->renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
47+
$this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
4848
$this->registerTwigRuntimeLoader($environment, $this->renderer);
4949
}
5050

src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function renderTemplate(FragmentHandler $renderer, $template = '{{ ren
7474
$twig = new \Twig_Environment($loader, array('debug' => true, 'cache' => false));
7575
$twig->addExtension(new HttpKernelExtension());
7676

77-
$loader = $this->getMock('Twig_RuntimeLoaderInterface');
77+
$loader = $this->getMockBuilder('Twig_RuntimeLoaderInterface')->getMock();
7878
$loader->expects($this->any())->method('load')->will($this->returnValueMap(array(
7979
array('Symfony\Bridge\Twig\Extension\HttpKernelRuntime', new HttpKernelRuntime($renderer)),
8080
)));

src/Symfony/Bridge/Twig/Tests/Extension/RuntimeLoaderProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ trait RuntimeLoaderProvider
1717
{
1818
protected function registerTwigRuntimeLoader(\Twig_Environment $environment, TwigRenderer $renderer)
1919
{
20-
$loader = $this->getMock('Twig_RuntimeLoaderInterface');
20+
$loader = $this->getMockBuilder('Twig_RuntimeLoaderInterface')->getMock();
2121
$loader->expects($this->any())->method('load')->will($this->returnValueMap(array(
2222
array('Symfony\Bridge\Twig\Form\TwigRenderer', $renderer),
2323
)));

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ public function testJsonWithSerializerContextOverride()
215215
public function testFile()
216216
{
217217
/* @var ContainerInterface $container */
218-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
219-
$kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
218+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
219+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
220220
$container->set('kernel', $kernel);
221221

222222
$controller = new TestController();
@@ -235,7 +235,7 @@ public function testFile()
235235

236236
public function testFileAsInline()
237237
{
238-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
238+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
239239
$controller = new TestController();
240240
$controller->setContainer($container);
241241

@@ -253,7 +253,7 @@ public function testFileAsInline()
253253

254254
public function testFileWithOwnFileName()
255255
{
256-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
256+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
257257
$controller = new TestController();
258258
$controller->setContainer($container);
259259

@@ -272,7 +272,7 @@ public function testFileWithOwnFileName()
272272

273273
public function testFileWithOwnFileNameAsInline()
274274
{
275-
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
275+
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
276276
$controller = new TestController();
277277
$controller->setContainer($container);
278278

0 commit comments

Comments
 (0)