Skip to content

Commit 5ee71b3

Browse files
committed
WiP
1 parent 6419fc8 commit 5ee71b3

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

tests/BuildTest.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
use Exception;
66
use PHPUnit\Framework\TestCase;
7+
use PHPUnit\Framework\Attributes\CoversClass;
8+
use PHPUnit\Framework\Attributes\DataProvider;
79
use RuntimeException;
810
use Symfony\Component\Console\Tester\CommandTester;
911
use org\bovigo\vfs\vfsStream;
1012
use s9e\RegexpBuilder\Command\Build;
1113

12-
/**
13-
* @covers s9e\RegexpBuilder\Command\Build
14-
*/
14+
#[CoversClass(Build::class)]
1515
class 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

tests/InputFormatter/JsonTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
namespace s9e\RegexpBuilder\Command\Tests;
44

5+
use PHPUnit\Framework\Attributes\CoversClass;
56
use PHPUnit\Framework\TestCase;
67
use s9e\RegexpBuilder\Command\InputFormatter\Json;
78

8-
/**
9-
* @covers s9e\RegexpBuilder\Command\InputFormatter\Json
10-
*/
9+
#[CoversClass(Json::class)]
1110
class JsonTest extends TestCase
1211
{
1312
public function test()

tests/InputFormatter/LsvTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
namespace s9e\RegexpBuilder\Command\Tests;
44

5+
use PHPUnit\Framework\Attributes\CoversClass;
56
use PHPUnit\Framework\TestCase;
67
use s9e\RegexpBuilder\Command\InputFormatter\Lsv;
78

8-
/**
9-
* @covers s9e\RegexpBuilder\Command\InputFormatter\Lsv
10-
*/
9+
#[CoversClass(Lsv::class)]
1110
class LsvTest extends TestCase
1211
{
1312
public function test()

0 commit comments

Comments
 (0)