Skip to content

Commit cecb157

Browse files
committed
fixed obsolete getMock() usage
1 parent 153dd72 commit cecb157

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

Tests/ApplicationTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ public function testFindAlternativeNamespace()
447447

448448
public function testFindNamespaceDoesNotFailOnDeepSimilarNamespaces()
449449
{
450-
$application = $this->getMock('Symfony\Component\Console\Application', array('getNamespaces'));
450+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getNamespaces'))->getMock();
451451
$application->expects($this->once())
452452
->method('getNamespaces')
453453
->will($this->returnValue(array('foo:sublong', 'bar:sub')));
@@ -469,7 +469,7 @@ public function testFindWithDoubleColonInNameThrowsException()
469469

470470
public function testSetCatchExceptions()
471471
{
472-
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
472+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock();
473473
$application->setAutoExit(false);
474474
$application->expects($this->any())
475475
->method('getTerminalWidth')
@@ -516,7 +516,7 @@ public function testLegacyAsXml()
516516

517517
public function testRenderException()
518518
{
519-
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
519+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock();
520520
$application->setAutoExit(false);
521521
$application->expects($this->any())
522522
->method('getTerminalWidth')
@@ -540,7 +540,7 @@ public function testRenderException()
540540
$tester->run(array('command' => 'foo3:bar'), array('decorated' => true));
541541
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions');
542542

543-
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
543+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock();
544544
$application->setAutoExit(false);
545545
$application->expects($this->any())
546546
->method('getTerminalWidth')
@@ -556,7 +556,7 @@ public function testRenderException()
556556
*/
557557
public function testRenderExceptionWithDoubleWidthCharacters()
558558
{
559-
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
559+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock();
560560
$application->setAutoExit(false);
561561
$application->expects($this->any())
562562
->method('getTerminalWidth')
@@ -572,7 +572,7 @@ public function testRenderExceptionWithDoubleWidthCharacters()
572572
$tester->run(array('command' => 'foo'), array('decorated' => true));
573573
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth1decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions');
574574

575-
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
575+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock();
576576
$application->setAutoExit(false);
577577
$application->expects($this->any())
578578
->method('getTerminalWidth')
@@ -706,7 +706,7 @@ public function testRunReturnsIntegerExitCode()
706706
{
707707
$exception = new \Exception('', 4);
708708

709-
$application = $this->getMock('Symfony\Component\Console\Application', array('doRun'));
709+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('doRun'))->getMock();
710710
$application->setAutoExit(false);
711711
$application->expects($this->once())
712712
->method('doRun')
@@ -721,7 +721,7 @@ public function testRunReturnsExitCodeOneForExceptionCodeZero()
721721
{
722722
$exception = new \Exception('', 0);
723723

724-
$application = $this->getMock('Symfony\Component\Console\Application', array('doRun'));
724+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('doRun'))->getMock();
725725
$application->setAutoExit(false);
726726
$application->expects($this->once())
727727
->method('doRun')

Tests/Command/CommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public function testRunReturnsIntegerExitCode()
273273
$exitCode = $command->run(new StringInput(''), new NullOutput());
274274
$this->assertSame(0, $exitCode, '->run() returns integer exit code (treats null as 0)');
275275

276-
$command = $this->getMock('TestCommand', array('execute'));
276+
$command = $this->getMockBuilder('TestCommand')->setMethods(array('execute'))->getMock();
277277
$command->expects($this->once())
278278
->method('execute')
279279
->will($this->returnValue('2.3'));

Tests/Helper/HelperSetTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function testIteration()
109109

110110
private function getGenericMockHelper($name, HelperSet $helperset = null)
111111
{
112-
$mock_helper = $this->getMock('\Symfony\Component\Console\Helper\HelperInterface');
112+
$mock_helper = $this->getMockBuilder('\Symfony\Component\Console\Helper\HelperInterface')->getMock();
113113
$mock_helper->expects($this->any())
114114
->method('getName')
115115
->will($this->returnValue($name));

Tests/Helper/LegacyProgressHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function testRegressProgress()
142142

143143
public function testRedrawFrequency()
144144
{
145-
$progress = $this->getMock('Symfony\Component\Console\Helper\ProgressHelper', array('display'));
145+
$progress = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressHelper')->setMethods(array('display'))->getMock();
146146
$progress->expects($this->exactly(4))
147147
->method('display');
148148

Tests/Helper/ProgressBarTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public function testRegressProgress()
294294

295295
public function testRedrawFrequency()
296296
{
297-
$bar = $this->getMock('Symfony\Component\Console\Helper\ProgressBar', array('display'), array($this->getOutputStream(), 6));
297+
$bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream(), 6))->getMock();
298298
$bar->expects($this->exactly(4))->method('display');
299299

300300
$bar->setRedrawFrequency(2);
@@ -307,7 +307,7 @@ public function testRedrawFrequency()
307307

308308
public function testRedrawFrequencyIsAtLeastOneIfZeroGiven()
309309
{
310-
$bar = $this->getMock('Symfony\Component\Console\Helper\ProgressBar', array('display'), array($this->getOutputStream()));
310+
$bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream()))->getMock();
311311

312312
$bar->expects($this->exactly(2))->method('display');
313313
$bar->setRedrawFrequency(0);
@@ -317,7 +317,7 @@ public function testRedrawFrequencyIsAtLeastOneIfZeroGiven()
317317

318318
public function testRedrawFrequencyIsAtLeastOneIfSmallerOneGiven()
319319
{
320-
$bar = $this->getMock('Symfony\Component\Console\Helper\ProgressBar', array('display'), array($this->getOutputStream()));
320+
$bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream()))->getMock();
321321

322322
$bar->expects($this->exactly(2))->method('display');
323323
$bar->setRedrawFrequency(0.9);

Tests/Helper/QuestionHelperTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public function testChoiceOutputFormattingQuestionForUtf8Keys()
388388
' [<info>żółw </info>] bar',
389389
' [<info>łabądź</info>] baz',
390390
);
391-
$output = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
391+
$output = $this->getMockBuilder('\Symfony\Component\Console\Output\OutputInterface')->getMock();
392392
$output->method('getFormatter')->willReturn(new OutputFormatter());
393393

394394
$dialog = new QuestionHelper();
@@ -449,7 +449,7 @@ protected function createOutputInterface()
449449

450450
protected function createInputInterfaceMock($interactive = true)
451451
{
452-
$mock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
452+
$mock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock();
453453
$mock->expects($this->any())
454454
->method('isInteractive')
455455
->will($this->returnValue($interactive));

Tests/Helper/SymfonyQuestionHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ protected function createOutputInterface()
132132

133133
protected function createInputInterfaceMock($interactive = true)
134134
{
135-
$mock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
135+
$mock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock();
136136
$mock->expects($this->any())
137137
->method('isInteractive')
138138
->will($this->returnValue($interactive));

0 commit comments

Comments
 (0)