44
55use Exception ;
66use PHPUnit \Framework \TestCase ;
7+ use PHPUnit \Framework \Attributes \CoversClass ;
8+ use PHPUnit \Framework \Attributes \DataProvider ;
79use RuntimeException ;
810use Symfony \Component \Console \Tester \CommandTester ;
911use org \bovigo \vfs \vfsStream ;
1012use s9e \RegexpBuilder \Command \Build ;
1113
12- /**
13- * @covers s9e\RegexpBuilder\Command\Build
14- */
14+ #[CoversClass(Build::class)]
1515class BuildTest extends TestCase
1616{
1717 public function testWriteFile ()
@@ -47,10 +47,8 @@ public function testWriteFileFailure()
4747 ]);
4848 }
4949
50- /**
51- * @dataProvider getSuccessTests
52- */
53- public function testSuccess (array $ input , string $ expectedOutput , callable $ setup = null ): void
50+ #[DataProvider('getBuildSuccessTests ' )]
51+ public function testBuildSuccess (array $ input , string $ expectedOutput , callable $ setup = null ): void
5452 {
5553 $ commandTester = new CommandTester (new Build );
5654 if (isset ($ setup ))
@@ -64,7 +62,7 @@ public function testSuccess(array $input, string $expectedOutput, callable $setu
6462 $ this ->assertEquals ($ expectedOutput , $ commandTester ->getDisplay ());
6563 }
6664
67- public static function getSuccessTests (): array
65+ public static function getBuildSuccessTests (): array
6866 {
6967 return [
7068 [
@@ -229,10 +227,8 @@ function (CommandTester $commandTester): void
229227 ];
230228 }
231229
232- /**
233- * @dataProvider getFailureTests
234- */
235- public function testFailure (array $ input , Exception $ exception , callable $ setup = null ): never
230+ #[DataProvider('getBuildFailureTests ' )]
231+ public function testBuildFailure (array $ input , Exception $ exception , callable $ setup = null ): never
236232 {
237233 $ this ->expectException (get_class ($ exception ));
238234 $ this ->expectExceptionMessage ($ exception ->getMessage ());
@@ -246,7 +242,7 @@ public function testFailure(array $input, Exception $exception, callable $setup
246242 }
247243
248244
249- public static function getFailureTests (): array
245+ public static function getBuildFailureTests (): array
250246 {
251247 vfsStream::setup ('root ' );
252248
0 commit comments