Skip to content

Commit

Permalink
ci(phpunit): use attributes (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod authored Feb 4, 2024
1 parent 57bdb42 commit e011bae
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
executionOrder="random"
colors="true"
bootstrap="tests/bootstrap.php"
failOnEmptyTestSuite="true"
failOnDeprecation="true"
failOnNotice="true"
failOnWarning="true"
>
<testsuites>
<testsuite name="Test Suite">
Expand Down
7 changes: 3 additions & 4 deletions tests/TestCheck/EveryTestHasGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>|null $requiredGroups
* @param list<string>|null $supportedGroups
*
* @dataProvider providerSuccess
*/
#[DataProvider('providerSuccess')]
public function testSuccess(
string $filePath,
array|null $requiredGroups,
Expand All @@ -38,9 +38,8 @@ public static function providerSuccess(): Generator
/**
* @param non-empty-list<string>|null $requiredGroups
* @param list<string>|null $supportedGroups
*
* @dataProvider providerFail
*/
#[DataProvider('providerFail')]
public function testFail(
string $filePath,
array|null $requiredGroups,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -29,7 +30,7 @@ public static function providerSuccess(): Generator
yield ['../../BaseTestCase.php'];
}

/** @dataProvider providerFail */
#[DataProvider('providerFail')]
public function testFail(string $filePath): void
{
try {
Expand Down

0 comments on commit e011bae

Please sign in to comment.