未验证 提交 4b210d91 编写于 作者: A Athos Ribeiro 提交者: GitHub

Add support for phpunit 10 (#11532)

* 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).

* https://github.com/sebastianbergmann/phpunit/issues/5132
上级 e7016b00
...@@ -57,7 +57,7 @@ public function testHomeCommandWithShowFlag( ...@@ -57,7 +57,7 @@ public function testHomeCommandWithShowFlag(
$this->assertSame(trim($expected), trim($appTester->getDisplay(true))); $this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
} }
public function useCaseProvider(): Generator public static function useCaseProvider(): Generator
{ {
yield 'Invalid or missing repository URL' => [ yield 'Invalid or missing repository URL' => [
[ [
......
...@@ -129,7 +129,7 @@ public function testSuggest(bool $hasLockFile, array $command, string $expected) ...@@ -129,7 +129,7 @@ public function testSuggest(bool $hasLockFile, array $command, string $expected)
self::assertSame(trim($expected), trim($appTester->getDisplay(true))); self::assertSame(trim($expected), trim($appTester->getDisplay(true)));
} }
public function provideSuggest(): \Generator public static function provideSuggest(): \Generator
{ {
yield 'with lockfile, show suggested' => [ yield 'with lockfile, show suggested' => [
true, true,
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
use Composer\Util\Platform; use Composer\Util\Platform;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
class ArchiveManagerTest extends ArchiverTest class ArchiveManagerTest extends ArchiverTestCase
{ {
/** /**
* @var ArchiveManager * @var ArchiveManager
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Package\CompletePackage; use Composer\Package\CompletePackage;
abstract class ArchiverTest extends TestCase abstract class ArchiverTestCase extends TestCase
{ {
/** /**
* @var \Composer\Util\Filesystem * @var \Composer\Util\Filesystem
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
use Composer\Package\Archiver\PharArchiver; use Composer\Package\Archiver\PharArchiver;
use Composer\Util\Platform; use Composer\Util\Platform;
class PharArchiverTest extends ArchiverTest class PharArchiverTest extends ArchiverTestCase
{ {
public function testTarArchive(): void public function testTarArchive(): void
{ {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
use ZipArchive; use ZipArchive;
use Composer\Package\Archiver\ZipArchiver; use Composer\Package\Archiver\ZipArchiver;
class ZipArchiverTest extends ArchiverTest class ZipArchiverTest extends ArchiverTestCase
{ {
/** /**
* @dataProvider provideGitignoreExcludeNegationTestCases * @dataProvider provideGitignoreExcludeNegationTestCases
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册