run tests using PHPUnit 11.5

This commit is contained in:
Christian Flothmann
2024-10-09 11:06:51 +02:00
committed by Christian Flothmann
parent 7b3bfe1acd
commit efb76ce5b1
2 changed files with 19 additions and 27 deletions

View File

@@ -11,8 +11,9 @@
namespace Symfony\Component\Console\Tests\Command;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
@@ -31,8 +32,6 @@ use Symfony\Component\Console\Tests\Fixtures\InvokableTestCommand;
class CommandTest extends TestCase
{
use ExpectUserDeprecationMessageTrait;
protected static string $fixturesPath;
public static function setUpBeforeClass(): void
@@ -471,9 +470,8 @@ class CommandTest extends TestCase
$this->assertSame(['f'], $command->getAliases());
}
/**
* @group legacy
*/
#[IgnoreDeprecations]
#[Group('legacy')]
public function testCommandAttributeWithDeprecatedMethods()
{
$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.');
@@ -491,9 +489,8 @@ class CommandTest extends TestCase
$this->assertSame('This is a command I wrote all by myself', $command->getDescription());
}
/**
* @group legacy
*/
#[IgnoreDeprecations]
#[Group('legacy')]
public function testAttributeOverridesPropertyWithDeprecatedMethods()
{
$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.');
@@ -517,9 +514,8 @@ class CommandTest extends TestCase
$this->assertEquals('foo2', $property->getValue($apl));
}
/**
* @group legacy
*/
#[IgnoreDeprecations]
#[Group('legacy')]
public function testDeprecatedMethods()
{
$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.');
@@ -528,9 +524,8 @@ class CommandTest extends TestCase
new FooCommand();
}
/**
* @group legacy
*/
#[IgnoreDeprecations]
#[Group('legacy')]
public function testDeprecatedNonIntegerReturnTypeFromClosureCode()
{
$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.');

View File

@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
failOnDeprecation="true"
failOnRisky="true"
failOnWarning="true"
>
@@ -18,7 +19,7 @@
</testsuite>
</testsuites>
<coverage>
<source ignoreSuppressionOfDeprecations="true">
<include>
<directory>./</directory>
</include>
@@ -27,15 +28,11 @@
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
</source>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
<arguments>
<array>
<element key="time-sensitive"><string>Symfony\Component\Console</string></element>
</array>
</arguments>
</listener>
</listeners>
<extensions>
<bootstrap class="Symfony\Bridge\PhpUnit\SymfonyExtension">
<parameter name="clock-mock-namespaces" value="Symfony\Component\Console" />
</bootstrap>
</extensions>
</phpunit>