diff --git a/Tests/ApplicationTest.php b/Tests/ApplicationTest.php index ca85c24b1..d8e1ae8b9 100644 --- a/Tests/ApplicationTest.php +++ b/Tests/ApplicationTest.php @@ -44,6 +44,7 @@ use Symfony\Component\Console\SignalRegistry\SignalRegistry; use Symfony\Component\Console\Terminal; use Symfony\Component\Console\Tester\ApplicationTester; +use Symfony\Component\Console\Tests\Fixtures\MockableAppliationWithTerminalWidth; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -932,7 +933,9 @@ public function testRenderExceptionEscapesLines() public function testRenderExceptionLineBreaks() { - $application = $this->getMockBuilder(Application::class)->addMethods(['getTerminalWidth'])->getMock(); + $application = $this->getMockBuilder(MockableAppliationWithTerminalWidth::class) + ->onlyMethods(['getTerminalWidth']) + ->getMock(); $application->setAutoExit(false); $application->expects($this->any()) ->method('getTerminalWidth') diff --git a/Tests/Fixtures/MockableAppliationWithTerminalWidth.php b/Tests/Fixtures/MockableAppliationWithTerminalWidth.php new file mode 100644 index 000000000..7f094ff3c --- /dev/null +++ b/Tests/Fixtures/MockableAppliationWithTerminalWidth.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Fixtures; + +use Symfony\Component\Console\Application; + +class MockableAppliationWithTerminalWidth extends Application +{ + public function getTerminalWidth(): int + { + return 0; + } +} diff --git a/Tests/Question/QuestionTest.php b/Tests/Question/QuestionTest.php index 6e8053a35..0bc6f75db 100644 --- a/Tests/Question/QuestionTest.php +++ b/Tests/Question/QuestionTest.php @@ -157,7 +157,7 @@ public function testSetAutocompleterValuesInvalid($values) public function testSetAutocompleterValuesWithTraversable() { $question1 = new Question('Test question 1'); - $iterator1 = $this->getMockForAbstractClass(\IteratorAggregate::class); + $iterator1 = $this->createMock(\IteratorAggregate::class); $iterator1 ->expects($this->once()) ->method('getIterator') @@ -165,7 +165,7 @@ public function testSetAutocompleterValuesWithTraversable() $question1->setAutocompleterValues($iterator1); $question2 = new Question('Test question 2'); - $iterator2 = $this->getMockForAbstractClass(\IteratorAggregate::class); + $iterator2 = $this->createMock(\IteratorAggregate::class); $iterator2 ->expects($this->once()) ->method('getIterator')