Skip to content

Commit de0a69c

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: fixed obsolete getMock() usage [WebProfilerBundle] Display multiple HTTP headers in WDT
2 parents d7dae10 + cecb157 commit de0a69c

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
@@ -454,7 +454,7 @@ public function testFindAlternativeNamespace()
454454

455455
public function testFindNamespaceDoesNotFailOnDeepSimilarNamespaces()
456456
{
457-
$application = $this->getMock('Symfony\Component\Console\Application', array('getNamespaces'));
457+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getNamespaces'))->getMock();
458458
$application->expects($this->once())
459459
->method('getNamespaces')
460460
->will($this->returnValue(array('foo:sublong', 'bar:sub')));
@@ -476,7 +476,7 @@ public function testFindWithDoubleColonInNameThrowsException()
476476

477477
public function testSetCatchExceptions()
478478
{
479-
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
479+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock();
480480
$application->setAutoExit(false);
481481
$application->expects($this->any())
482482
->method('getTerminalWidth')
@@ -523,7 +523,7 @@ public function testLegacyAsXml()
523523

524524
public function testRenderException()
525525
{
526-
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
526+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock();
527527
$application->setAutoExit(false);
528528
$application->expects($this->any())
529529
->method('getTerminalWidth')
@@ -547,7 +547,7 @@ public function testRenderException()
547547
$tester->run(array('command' => 'foo3:bar'), array('decorated' => true));
548548
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions');
549549

550-
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
550+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock();
551551
$application->setAutoExit(false);
552552
$application->expects($this->any())
553553
->method('getTerminalWidth')
@@ -560,7 +560,7 @@ public function testRenderException()
560560

561561
public function testRenderExceptionWithDoubleWidthCharacters()
562562
{
563-
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
563+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock();
564564
$application->setAutoExit(false);
565565
$application->expects($this->any())
566566
->method('getTerminalWidth')
@@ -576,7 +576,7 @@ public function testRenderExceptionWithDoubleWidthCharacters()
576576
$tester->run(array('command' => 'foo'), array('decorated' => true));
577577
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth1decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions');
578578

579-
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
579+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock();
580580
$application->setAutoExit(false);
581581
$application->expects($this->any())
582582
->method('getTerminalWidth')
@@ -710,7 +710,7 @@ public function testRunReturnsIntegerExitCode()
710710
{
711711
$exception = new \Exception('', 4);
712712

713-
$application = $this->getMock('Symfony\Component\Console\Application', array('doRun'));
713+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('doRun'))->getMock();
714714
$application->setAutoExit(false);
715715
$application->expects($this->once())
716716
->method('doRun')
@@ -725,7 +725,7 @@ public function testRunReturnsExitCodeOneForExceptionCodeZero()
725725
{
726726
$exception = new \Exception('', 0);
727727

728-
$application = $this->getMock('Symfony\Component\Console\Application', array('doRun'));
728+
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('doRun'))->getMock();
729729
$application->setAutoExit(false);
730730
$application->expects($this->once())
731731
->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
@@ -110,7 +110,7 @@ public function testIteration()
110110

111111
private function getGenericMockHelper($name, HelperSet $helperset = null)
112112
{
113-
$mock_helper = $this->getMock('\Symfony\Component\Console\Helper\HelperInterface');
113+
$mock_helper = $this->getMockBuilder('\Symfony\Component\Console\Helper\HelperInterface')->getMock();
114114
$mock_helper->expects($this->any())
115115
->method('getName')
116116
->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)