Skip to content

Commit fb9eba1

Browse files
committed
replace expectDeprecation() with expectUserDeprecationMessage()
1 parent a16e315 commit fb9eba1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Tests/Command/CommandTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Component\Console\Tests\Command;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
15+
use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait;
1616
use Symfony\Component\Console\Application;
1717
use Symfony\Component\Console\Attribute\AsCommand;
1818
use Symfony\Component\Console\Command\Command;
@@ -30,7 +30,7 @@
3030

3131
class CommandTest extends TestCase
3232
{
33-
use ExpectDeprecationTrait;
33+
use ExpectUserDeprecationMessageTrait;
3434

3535
protected static string $fixturesPath;
3636

@@ -453,8 +453,8 @@ public function testCommandAttribute()
453453
*/
454454
public function testCommandAttributeWithDeprecatedMethods()
455455
{
456-
$this->expectDeprecation('Since symfony/console 7.3: Method "Symfony\Component\Console\Command\Command::getDefaultName()" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
457-
$this->expectDeprecation('Since symfony/console 7.3: Method "Symfony\Component\Console\Command\Command::getDefaultDescription()" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
456+
$this->expectUserDeprecationMessage('Since symfony/console 7.3: Method "Symfony\Component\Console\Command\Command::getDefaultName()" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
457+
$this->expectUserDeprecationMessage('Since symfony/console 7.3: Method "Symfony\Component\Console\Command\Command::getDefaultDescription()" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
458458

459459
$this->assertSame('|foo|f', Php8Command::getDefaultName());
460460
$this->assertSame('desc', Php8Command::getDefaultDescription());
@@ -473,8 +473,8 @@ public function testAttributeOverridesProperty()
473473
*/
474474
public function testAttributeOverridesPropertyWithDeprecatedMethods()
475475
{
476-
$this->expectDeprecation('Since symfony/console 7.3: Method "Symfony\Component\Console\Command\Command::getDefaultName()" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
477-
$this->expectDeprecation('Since symfony/console 7.3: Method "Symfony\Component\Console\Command\Command::getDefaultDescription()" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
476+
$this->expectUserDeprecationMessage('Since symfony/console 7.3: Method "Symfony\Component\Console\Command\Command::getDefaultName()" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
477+
$this->expectUserDeprecationMessage('Since symfony/console 7.3: Method "Symfony\Component\Console\Command\Command::getDefaultDescription()" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
478478

479479
$this->assertSame('my:command', MyAnnotatedCommand::getDefaultName());
480480
$this->assertSame('This is a command I wrote all by myself', MyAnnotatedCommand::getDefaultDescription());
@@ -499,8 +499,8 @@ public function testDefaultCommand()
499499
*/
500500
public function testDeprecatedMethods()
501501
{
502-
$this->expectDeprecation('Since symfony/console 7.3: Overriding "Command::getDefaultName()" in "Symfony\Component\Console\Tests\Command\FooCommand" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
503-
$this->expectDeprecation('Since symfony/console 7.3: Overriding "Command::getDefaultDescription()" in "Symfony\Component\Console\Tests\Command\FooCommand" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
502+
$this->expectUserDeprecationMessage('Since symfony/console 7.3: Overriding "Command::getDefaultName()" in "Symfony\Component\Console\Tests\Command\FooCommand" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
503+
$this->expectUserDeprecationMessage('Since symfony/console 7.3: Overriding "Command::getDefaultDescription()" in "Symfony\Component\Console\Tests\Command\FooCommand" is deprecated and will be removed in Symfony 8.0, use the #[AsCommand] attribute instead.');
504504

505505
new FooCommand();
506506
}
@@ -510,7 +510,7 @@ public function testDeprecatedMethods()
510510
*/
511511
public function testDeprecatedNonIntegerReturnTypeFromClosureCode()
512512
{
513-
$this->expectDeprecation('Since symfony/console 7.3: Returning a non-integer value from the command "foo" is deprecated and will throw an exception in Symfony 8.0.');
513+
$this->expectUserDeprecationMessage('Since symfony/console 7.3: Returning a non-integer value from the command "foo" is deprecated and will throw an exception in Symfony 8.0.');
514514

515515
$command = new Command('foo');
516516
$command->setCode(function () {});

0 commit comments

Comments
 (0)