Skip to content

Commit

Permalink
Add support for phpunit 10 (#11532)
Browse files Browse the repository at this point in the history
* Use static test data providers

Using non-static methods as a data providers was deprecated in phpunit
10.

* Rename abstract test class

Abstract test case classes with Test suffix are deprecated in PHPUnit
10. We also change the ArchiverTest file name to match the new class
name (ArchiverTestCase).

* sebastianbergmann/phpunit#5132
  • Loading branch information
athos-ribeiro committed Jul 21, 2023
1 parent e7016b0 commit 4b210d9
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/Composer/Test/Command/HomeCommandTest.php
Expand Up @@ -57,7 +57,7 @@ public function testHomeCommandWithShowFlag(
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
}

public function useCaseProvider(): Generator
public static function useCaseProvider(): Generator
{
yield 'Invalid or missing repository URL' => [
[
Expand Down
2 changes: 1 addition & 1 deletion tests/Composer/Test/Command/SuggestsCommandTest.php
Expand Up @@ -129,7 +129,7 @@ public function testSuggest(bool $hasLockFile, array $command, string $expected)
self::assertSame(trim($expected), trim($appTester->getDisplay(true)));
}

public function provideSuggest(): \Generator
public static function provideSuggest(): \Generator
{
yield 'with lockfile, show suggested' => [
true,
Expand Down
Expand Up @@ -21,7 +21,7 @@
use Composer\Util\Platform;
use Composer\Util\ProcessExecutor;

class ArchiveManagerTest extends ArchiverTest
class ArchiveManagerTest extends ArchiverTestCase
{
/**
* @var ArchiveManager
Expand Down
Expand Up @@ -17,7 +17,7 @@
use Composer\Util\ProcessExecutor;
use Composer\Package\CompletePackage;

abstract class ArchiverTest extends TestCase
abstract class ArchiverTestCase extends TestCase
{
/**
* @var \Composer\Util\Filesystem
Expand Down
2 changes: 1 addition & 1 deletion tests/Composer/Test/Package/Archiver/PharArchiverTest.php
Expand Up @@ -15,7 +15,7 @@
use Composer\Package\Archiver\PharArchiver;
use Composer\Util\Platform;

class PharArchiverTest extends ArchiverTest
class PharArchiverTest extends ArchiverTestCase
{
public function testTarArchive(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Composer/Test/Package/Archiver/ZipArchiverTest.php
Expand Up @@ -16,7 +16,7 @@
use ZipArchive;
use Composer\Package\Archiver\ZipArchiver;

class ZipArchiverTest extends ArchiverTest
class ZipArchiverTest extends ArchiverTestCase
{
/**
* @dataProvider provideGitignoreExcludeNegationTestCases
Expand Down

0 comments on commit 4b210d9

Please sign in to comment.