Skip to content

Commit

Permalink
minor #54785 Remove calls to TestCase::iniSet() and calls to deprec…
Browse files Browse the repository at this point in the history
…ated methods of `MockBuilder` (alexandre-daubois)

This PR was merged into the 5.4 branch.

Discussion
----------

Remove calls to `TestCase::iniSet()` and calls to deprecated methods of `MockBuilder`

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Last round (before new deprecations 🙂). All deprecations [listed here](https://github.com/sebastianbergmann/phpunit/blob/main/DEPRECATIONS.md) should be gone.

Commits
-------

4d5065ddd9 Remove calls to `TestCase::iniSet()` and calls to deprecated methods of `MockBuilder`
  • Loading branch information
xabbuh committed May 15, 2024
2 parents 58b1658 + b695405 commit 96dfcec
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 96dfcec

Please sign in to comment.