diff --git a/.gitignore b/.gitignore index 8b7ef35..b868185 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /vendor composer.lock +.phpunit.cache diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6d5d638..e73eed7 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,21 +1,23 @@ - - ./tests - - - ./tests/functional - - - - ./src - - + + + ./tests + + + ./tests/functional + + + + + ./src + + diff --git a/tests/Command/CheckGherkinCodeStyleTest.php b/tests/Command/CheckGherkinCodeStyleTest.php index a9b1fc1..3b01980 100644 --- a/tests/Command/CheckGherkinCodeStyleTest.php +++ b/tests/Command/CheckGherkinCodeStyleTest.php @@ -24,23 +24,17 @@ use Behat\Gherkin\Node\TableNode; use Behat\Gherkin\Parser; use KawaiiGherkin\Command\CheckGherkinCodeStyle; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -/** - * Tests for {@see \KawaiiGherkin\Command\CheckGherkinCodeStyle} - * - * @author Jefersson Nathan - * @covers \KawaiiGherkin\Command\CheckGherkinCodeStyle - * @group Coverage - * @license MIT - */ +#[CoversClass(CheckGherkinCodeStyle::class)] final class CheckGherkinCodeStyleTest extends TestCase { public function testShouldReturnOkIfThereIsNoFilesFound() { - /* @var \Behat\Gherkin\Parser|\PHPUnit_Framework_MockObject_MockObject $parser */ + /* @var \Behat\Gherkin\Parser|\PHPUnit\Framework\MockObject\MockObject $parser */ $parser = $this->getMockBuilder(Parser::class) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/FeatureResolveTest.php b/tests/FeatureResolveTest.php index 583c62c..fb7b760 100644 --- a/tests/FeatureResolveTest.php +++ b/tests/FeatureResolveTest.php @@ -3,22 +3,19 @@ namespace KawaiiGherkinTest; use KawaiiGherkin\FeatureResolve; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; final class FeatureResolveTest extends TestCase { - /** - * @dataProvider unExistsDirectory - * - * @param string $directory - * @param string $expectedDirectory - * @param string $expectedFile - */ - public function testShouldReturnCorrectDirectory( - $directory, - $expectedDirectory, - $expectedFile - ) { + #[Test] + #[DataProvider('unExistsDirectory')] + public function itShouldReturnCorrectDirectory( + string $directory, + string $expectedDirectory, + string $expectedFile + ): void { $feature = new FeatureResolve($directory); self::assertObjectHasProperty('directoryOrFile', $feature); diff --git a/tests/Formatter/BackgroundTest.php b/tests/Formatter/BackgroundTest.php index d976e70..a4f6c14 100644 --- a/tests/Formatter/BackgroundTest.php +++ b/tests/Formatter/BackgroundTest.php @@ -22,23 +22,15 @@ use Behat\Gherkin\Node\StepNode; use Behat\Gherkin\Node\TableNode; use KawaiiGherkin\Formatter\Background; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use Prophecy\Argument; -/** - * Tests for {@see \KawaiiGherkin\Formatter\Background} - * - * @author Jefersson Nathan - * @covers \KawaiiGherkin\Formatter\Background - * @group Coverage - * @license MIT - */ +#[CoversClass(Background::class)] final class BackgroundTest extends TestCase { - /** - * @var Background - */ - private $formatter; + private Background $formatter; /** * {@inheritDoc} @@ -48,7 +40,8 @@ public function setUp(): void $this->formatter = new Background(); } - public function testCanFormatFeatureDescription() + #[Test] + public function canFormatFeatureDescription(): void { $expected = << - * @covers \KawaiiGherkin\Formatter\Example - * @group Coverage - * @license MIT - */ +#[CoversClass(Example::class)] final class ExampleTest extends TestCase { - /** - * @var Example - */ - private $formatter; + private Example $formatter; - /** - * {@inheritDoc} - */ public function setUp(): void { $this->formatter = new Example(); } - public function testCanGenerateExamplesTableProperly(): void + #[Test] + public function canGenerateExamplesTableProperly(): void { $expected = <<formatter->format($outlineNode)); } - public function testShouldReturnVoidIfThereIsNoExample() + #[Test] + public function shouldReturnVoidIfThereIsNoExample(): void { $outlineNode = new OutlineNode( '', diff --git a/tests/Formatter/FeatureDescriptionTest.php b/tests/Formatter/FeatureDescriptionTest.php index 5eb14b5..bfc5874 100644 --- a/tests/Formatter/FeatureDescriptionTest.php +++ b/tests/Formatter/FeatureDescriptionTest.php @@ -20,32 +20,22 @@ use Behat\Gherkin\Node\FeatureNode; use KawaiiGherkin\Formatter\FeatureDescription; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; -/** - * Tests for {@see \KawaiiGherkin\Formatter\FeatureDescription} - * - * @author Jefersson Nathan - * @covers \KawaiiGherkin\Formatter\FeatureDescription - * @group Coverage - * @license MIT - */ +#[CoversClass(FeatureDescription::class)] final class FeatureDescriptionTest extends TestCase { - /** - * @var FeatureDescription - */ - private $formatter; + private FeatureDescription $formatter; - /** - * {@inheritDoc} - */ public function setUp(): void { $this->formatter = new FeatureDescription(); } - public function testCanFormatFeatureDescription() + #[Test] + public function canFormatFeatureDescription(): void { $expected =<< - * @covers \KawaiiGherkin\Formatter\Scenario - * @group Coverage - * @license MIT -*/ +#[CoversClass(Scenario::class)] final class ScenarioTest extends TestCase { - /** - * @var Scenario - */ - private $formatter; - - /** - * {@inheritDoc} - */ + private Scenario $formatter; + public function setUp(): void { $this->formatter = new Scenario(); diff --git a/tests/Formatter/StepTest.php b/tests/Formatter/StepTest.php index b1fb6a5..a582124 100644 --- a/tests/Formatter/StepTest.php +++ b/tests/Formatter/StepTest.php @@ -23,26 +23,14 @@ use Behat\Gherkin\Node\StepNode; use Behat\Gherkin\Node\TableNode; use KawaiiGherkin\Formatter\Step; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * Tests for {@see \KawaiiGherkin\Formatter\Step} - * - * @author Jefersson Nathan - * @covers \KawaiiGherkin\Formatter\Step - * @group Coverage - * @license MIT - */ +#[CoversClass(Step::class)] final class StepTest extends TestCase { - /** - * @var Step - */ - private $formatter; - - /** - * {@inheritDoc} - */ + private Step $formatter; + public function setUp(): void { $this->formatter = new Step(); diff --git a/tests/Formatter/TagsTest.php b/tests/Formatter/TagsTest.php index 5dd3c02..68264bd 100644 --- a/tests/Formatter/TagsTest.php +++ b/tests/Formatter/TagsTest.php @@ -19,32 +19,24 @@ namespace KawaiiGherkinTest\Formatter; use KawaiiGherkin\Formatter\Tags; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; -/** - * Tests for {@see \KawaiiGherkin\Formatter\Tags} - * - * @author Jefersson Nathan - * @covers \KawaiiGherkin\Formatter\Tags - * @group Coverage - * @license MIT - */ +#[Small] +#[CoversClass(Tags::class)] final class TagsTest extends TestCase { - /** - * @var Tags - */ - private $formatter; + private Tags $formatter; - /** - * {@inheritDoc} - */ public function setUp(): void { $this->formatter = new Tags(); } - public function testCanFormatTag() + #[Test] + public function canFormatTag(): void { $wrongTagsInput = [ ' user ',