Skip to content

Commit e011bae

Browse files
authored
ci(phpunit): use attributes (#94)
1 parent 57bdb42 commit e011bae

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
executionOrder="random"
99
colors="true"
1010
bootstrap="tests/bootstrap.php"
11+
failOnEmptyTestSuite="true"
12+
failOnDeprecation="true"
13+
failOnNotice="true"
14+
failOnWarning="true"
1115
>
1216
<testsuites>
1317
<testsuite name="Test Suite">

tests/TestCheck/EveryTestHasGroupTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
use Cdn77\TestUtils\Tests\BaseTestCase;
99
use Generator;
1010
use PHPUnit\Framework\AssertionFailedError;
11+
use PHPUnit\Framework\Attributes\DataProvider;
1112

1213
final class EveryTestHasGroupTest extends BaseTestCase
1314
{
1415
/**
1516
* @param non-empty-list<string>|null $requiredGroups
1617
* @param list<string>|null $supportedGroups
17-
*
18-
* @dataProvider providerSuccess
1918
*/
19+
#[DataProvider('providerSuccess')]
2020
public function testSuccess(
2121
string $filePath,
2222
array|null $requiredGroups,
@@ -38,9 +38,8 @@ public static function providerSuccess(): Generator
3838
/**
3939
* @param non-empty-list<string>|null $requiredGroups
4040
* @param list<string>|null $supportedGroups
41-
*
42-
* @dataProvider providerFail
4341
*/
42+
#[DataProvider('providerFail')]
4443
public function testFail(
4544
string $filePath,
4645
array|null $requiredGroups,

tests/TestCheck/EveryTestHasSameNamespaceAsCoveredClassTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
use Cdn77\TestUtils\Tests\BaseTestCase;
99
use Generator;
1010
use PHPUnit\Framework\AssertionFailedError;
11+
use PHPUnit\Framework\Attributes\DataProvider;
1112

1213
final class EveryTestHasSameNamespaceAsCoveredClassTest extends BaseTestCase
1314
{
14-
/** @dataProvider providerSuccess */
15+
#[DataProvider('providerSuccess')]
1516
public function testSuccess(string $filePath): void
1617
{
1718
$check = new EveryTestHasSameNamespaceAsCoveredClass(
@@ -37,7 +38,7 @@ public static function providerSuccess(): Generator
3738
}
3839
}
3940

40-
/** @dataProvider providerFail */
41+
#[DataProvider('providerFail')]
4142
public function testFail(string $filePath, string $error): void
4243
{
4344
$this->expectException(AssertionFailedError::class);

tests/TestCheck/EveryTestInheritsFromTestCaseBaseClassTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
use Cdn77\TestUtils\Tests\BaseTestCase;
99
use Generator;
1010
use PHPUnit\Framework\AssertionFailedError;
11+
use PHPUnit\Framework\Attributes\DataProvider;
1112

1213
final class EveryTestInheritsFromTestCaseBaseClassTest extends BaseTestCase
1314
{
14-
/** @dataProvider providerSuccess */
15+
#[DataProvider('providerSuccess')]
1516
public function testSuccess(string $filePath): void
1617
{
1718
$check = new EveryTestInheritsFromTestCaseBaseClass(
@@ -29,7 +30,7 @@ public static function providerSuccess(): Generator
2930
yield ['../../BaseTestCase.php'];
3031
}
3132

32-
/** @dataProvider providerFail */
33+
#[DataProvider('providerFail')]
3334
public function testFail(string $filePath): void
3435
{
3536
try {

0 commit comments

Comments
 (0)