Skip to content

Commit

Permalink
Remove calls to TestCase::iniSet() and calls to deprecated methods …
Browse files Browse the repository at this point in the history
…of `MockBuilder`
  • Loading branch information
alexandre-daubois committed May 6, 2024
1 parent f3e591c commit b695405
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Tests/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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;
Expand Down Expand Up @@ -876,7 +877,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')
Expand Down
22 changes: 22 additions & 0 deletions Tests/Fixtures/MockableAppliationWithTerminalWidth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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;
}
}

0 comments on commit b695405

Please sign in to comment.