From e011bae7eaa9dd8ff4f0ffb801279229244075bd Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Sun, 4 Feb 2024 12:04:26 +0100 Subject: [PATCH] ci(phpunit): use attributes (#94) --- phpunit.xml.dist | 4 ++++ tests/TestCheck/EveryTestHasGroupTest.php | 7 +++---- .../EveryTestHasSameNamespaceAsCoveredClassTest.php | 5 +++-- .../EveryTestInheritsFromTestCaseBaseClassTest.php | 5 +++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f580589..3367381 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,6 +8,10 @@ executionOrder="random" colors="true" bootstrap="tests/bootstrap.php" + failOnEmptyTestSuite="true" + failOnDeprecation="true" + failOnNotice="true" + failOnWarning="true" > diff --git a/tests/TestCheck/EveryTestHasGroupTest.php b/tests/TestCheck/EveryTestHasGroupTest.php index 94c86aa..31d1f3e 100644 --- a/tests/TestCheck/EveryTestHasGroupTest.php +++ b/tests/TestCheck/EveryTestHasGroupTest.php @@ -8,15 +8,15 @@ use Cdn77\TestUtils\Tests\BaseTestCase; use Generator; use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Attributes\DataProvider; final class EveryTestHasGroupTest extends BaseTestCase { /** * @param non-empty-list|null $requiredGroups * @param list|null $supportedGroups - * - * @dataProvider providerSuccess */ + #[DataProvider('providerSuccess')] public function testSuccess( string $filePath, array|null $requiredGroups, @@ -38,9 +38,8 @@ public static function providerSuccess(): Generator /** * @param non-empty-list|null $requiredGroups * @param list|null $supportedGroups - * - * @dataProvider providerFail */ + #[DataProvider('providerFail')] public function testFail( string $filePath, array|null $requiredGroups, diff --git a/tests/TestCheck/EveryTestHasSameNamespaceAsCoveredClassTest.php b/tests/TestCheck/EveryTestHasSameNamespaceAsCoveredClassTest.php index fe3b51a..6eb3c52 100644 --- a/tests/TestCheck/EveryTestHasSameNamespaceAsCoveredClassTest.php +++ b/tests/TestCheck/EveryTestHasSameNamespaceAsCoveredClassTest.php @@ -8,10 +8,11 @@ use Cdn77\TestUtils\Tests\BaseTestCase; use Generator; use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Attributes\DataProvider; final class EveryTestHasSameNamespaceAsCoveredClassTest extends BaseTestCase { - /** @dataProvider providerSuccess */ + #[DataProvider('providerSuccess')] public function testSuccess(string $filePath): void { $check = new EveryTestHasSameNamespaceAsCoveredClass( @@ -37,7 +38,7 @@ public static function providerSuccess(): Generator } } - /** @dataProvider providerFail */ + #[DataProvider('providerFail')] public function testFail(string $filePath, string $error): void { $this->expectException(AssertionFailedError::class); diff --git a/tests/TestCheck/EveryTestInheritsFromTestCaseBaseClassTest.php b/tests/TestCheck/EveryTestInheritsFromTestCaseBaseClassTest.php index ea4413c..909cc57 100644 --- a/tests/TestCheck/EveryTestInheritsFromTestCaseBaseClassTest.php +++ b/tests/TestCheck/EveryTestInheritsFromTestCaseBaseClassTest.php @@ -8,10 +8,11 @@ use Cdn77\TestUtils\Tests\BaseTestCase; use Generator; use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Attributes\DataProvider; final class EveryTestInheritsFromTestCaseBaseClassTest extends BaseTestCase { - /** @dataProvider providerSuccess */ + #[DataProvider('providerSuccess')] public function testSuccess(string $filePath): void { $check = new EveryTestInheritsFromTestCaseBaseClass( @@ -29,7 +30,7 @@ public static function providerSuccess(): Generator yield ['../../BaseTestCase.php']; } - /** @dataProvider providerFail */ + #[DataProvider('providerFail')] public function testFail(string $filePath): void { try {