diff --git a/composer.json b/composer.json index 1f223cbd..a05deee9 100644 --- a/composer.json +++ b/composer.json @@ -45,20 +45,20 @@ "phpunit/php-timer": "^6.0", "phpunit/phpunit": "^10.5.5", "sebastian/environment": "^6.0.1", - "symfony/console": "^6.3.4 || ^7.0.0", - "symfony/process": "^6.3.4 || ^7.0.0" + "symfony/console": "^6.4.2 || ^7.0.2", + "symfony/process": "^6.4.2 || ^7.0.2" }, "require-dev": { "ext-pcov": "*", "ext-posix": "*", "doctrine/coding-standard": "^12.0.0", "infection/infection": "^0.27.9", - "phpstan/phpstan": "^1.10.54", + "phpstan/phpstan": "^1.10.55", "phpstan/phpstan-deprecation-rules": "^1.1.4", "phpstan/phpstan-phpunit": "^1.3.15", "phpstan/phpstan-strict-rules": "^1.5.2", "squizlabs/php_codesniffer": "^3.8.0", - "symfony/filesystem": "^6.3.1 || ^7.0.0" + "symfony/filesystem": "^6.4.0 || ^7.0.0" }, "autoload": { "psr-4": { diff --git a/test/Unit/Util/PhpstormHelperTest.php b/test/Unit/Util/PhpstormHelperTest.php index b08d78e3..605931d5 100644 --- a/test/Unit/Util/PhpstormHelperTest.php +++ b/test/Unit/Util/PhpstormHelperTest.php @@ -7,6 +7,7 @@ use Generator; use ParaTest\Util\PhpstormHelper; use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use RuntimeException; @@ -31,9 +32,8 @@ public function testThrowExceptionWithInvalidArgv(): void /** * @param array $argv * @param array $expectedArgv - * - * @dataProvider providePhpstormCases */ + #[DataProvider('providePhpstormCases')] public function testPhpStormHelper( array $argv, array $expectedArgv, diff --git a/test/Unit/WrapperRunner/WrapperRunnerTest.php b/test/Unit/WrapperRunner/WrapperRunnerTest.php index 5b740256..72cc4cf2 100644 --- a/test/Unit/WrapperRunner/WrapperRunnerTest.php +++ b/test/Unit/WrapperRunner/WrapperRunnerTest.php @@ -14,7 +14,11 @@ use ParaTest\WrapperRunner\WrapperWorker; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily; use PHPUnit\Framework\Attributes\RequiresPhp; +use PHPUnit\Framework\Attributes\RequiresPhpunit; use SebastianBergmann\CodeCoverage\CodeCoverage; use Symfony\Component\Process\Process; @@ -57,7 +61,7 @@ final class WrapperRunnerTest extends TestBase public const PASSTHRU_PHP_CUSTOM = 'PASSTHRU_PHP_CUSTOM'; - /** @dataProvider provideForWrapperRunnerHandlesBatchSize */ + #[DataProvider('provideForWrapperRunnerHandlesBatchSize')] public function testWrapperRunnerHandlesBatchSize(int $processes, ?int $batchSize, int $expectedPidCount): void { $this->bareOptions['--no-configuration'] = true; @@ -118,7 +122,7 @@ private function extractContentFromDirFiles(string $path): array return array_unique($res); } - /** @group github */ + #[Group('github')] #[CoversNothing] public function testReadPhpunitConfigPhpSectionBeforeLoadingTheSuite(): void { @@ -177,7 +181,7 @@ public function testRunnerSortNoSeedProvided(): void self::assertStringContainsString('Random Seed:', $runnerResult->output); } - /** @group github */ + #[Group('github')] #[CoversNothing] public function testErrorsInDataProviderAreHandled(): void { @@ -227,7 +231,7 @@ public function testPassthrus(): void self::assertSame(RunnerInterface::SUCCESS_EXIT, $runnerResult->exitCode); } - /** @group github */ + #[Group('github')] #[CoversNothing] public function testReadPhpunitConfigPhpSectionBeforeLoadingTheSuiteManualBootstrap(): void { @@ -267,7 +271,7 @@ public function testExitCodesPathWithoutTests(): void self::assertSame(RunnerInterface::SUCCESS_EXIT, $runnerResult->exitCode); } - /** @requires OSFAMILY Linux */ + #[RequiresOperatingSystemFamily('Linux')] public function testTeamcityLogHandlesFifoFiles(): void { $outputPath = $this->tmpDir . DIRECTORY_SEPARATOR . 'test-output.teamcity'; @@ -433,7 +437,7 @@ public function testRunnerReversed(): void self::assertSame($defaultOrder, $reverseOrderReversed); } - /** @group github */ + #[Group('github')] #[CoversNothing] public function testTokensAreAbsentWhenNoTestTokensIsSpecified(): void { @@ -518,8 +522,9 @@ public function testHandleCollisionWithSymfonyOutput(): void self::assertStringContainsString('', $runnerResult->output); } - /** @group github */ + #[Group('github')] #[CoversNothing] + #[RequiresPhpunit('10')] public function testIgnoreAttributes(): void { $this->bareOptions['--configuration'] = $this->fixture('github' . DIRECTORY_SEPARATOR . 'GH756' . DIRECTORY_SEPARATOR . 'phpunit.xml'); @@ -580,7 +585,7 @@ public function testHandleUnexpectedOutput(): void self::assertStringMatchesFormat($expectedOutput, $runnerResult->output); } - /** @group github */ + #[Group('github')] #[CoversNothing] public function testGroupOptionWithDataProviderAndCodeCoverageEnabled(): void { diff --git a/test/fixtures/fatal_tests/UnitTestWithFatalParseErrorTest.php b/test/fixtures/fatal_tests/UnitTestWithFatalParseErrorTest.php index e0fde68f..ed2724e0 100644 --- a/test/fixtures/fatal_tests/UnitTestWithFatalParseErrorTest.php +++ b/test/fixtures/fatal_tests/UnitTestWithFatalParseErrorTest.php @@ -4,6 +4,7 @@ namespace ParaTest\Tests\fixtures\fatal_tests; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; /** @@ -11,9 +12,7 @@ */ final class UnitTestWithFatalParseErrorTest extends TestCase { - /** - * @group fixtures - */ + #[Group('fixtures')] public function testTruth(): void { I will fail fataly because this is not a php statement . diff --git a/test/fixtures/function_parallelization_tests/FunctionalParallelizationTest.php b/test/fixtures/function_parallelization_tests/FunctionalParallelizationTest.php index 3436435f..db570845 100644 --- a/test/fixtures/function_parallelization_tests/FunctionalParallelizationTest.php +++ b/test/fixtures/function_parallelization_tests/FunctionalParallelizationTest.php @@ -4,6 +4,7 @@ namespace ParaTest\Tests\fixtures\function_parallelization_tests; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @internal */ @@ -29,13 +30,13 @@ public static function dataProvider2(): array ]; } - /** @dataProvider dataProvider1 */ + #[DataProvider('dataProvider1')] public function testDataProvider1(string $a, string $b): void { self::assertEquals($a, $b); } - /** @dataProvider dataProvider2 */ + #[DataProvider('dataProvider2')] public function testDataProvider2(string $a, string $b): void { self::assertEquals($a, $b); diff --git a/test/fixtures/github/GH420/IssueTest.php b/test/fixtures/github/GH420/IssueTest.php index 8609de98..07cd5485 100644 --- a/test/fixtures/github/GH420/IssueTest.php +++ b/test/fixtures/github/GH420/IssueTest.php @@ -4,6 +4,7 @@ namespace ParaTest\Tests\fixtures\github\GH420; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function defined; @@ -12,7 +13,7 @@ /** @internal */ final class IssueTest extends TestCase { - /** @dataProvider provideCases */ + #[DataProvider('provideCases')] public function testCases(bool $true): void { self::assertTrue($true); diff --git a/test/fixtures/github/GH420bis/IssueTest.php b/test/fixtures/github/GH420bis/IssueTest.php index 37195488..95063dce 100644 --- a/test/fixtures/github/GH420bis/IssueTest.php +++ b/test/fixtures/github/GH420bis/IssueTest.php @@ -4,6 +4,7 @@ namespace ParaTest\Tests\fixtures\github\GH420bis; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function defined; @@ -11,7 +12,7 @@ /** @internal */ final class IssueTest extends TestCase { - /** @dataProvider provideCases */ + #[DataProvider('provideCases')] public function testCases(string $constant): void { self::assertStringContainsString('ISSUE_420_BIS_', $constant); diff --git a/test/fixtures/github/GH565/IssueTest.php b/test/fixtures/github/GH565/IssueTest.php index d1029886..85de3462 100644 --- a/test/fixtures/github/GH565/IssueTest.php +++ b/test/fixtures/github/GH565/IssueTest.php @@ -5,12 +5,13 @@ namespace ParaTest\Tests\fixtures\github\GH565; use LogicException; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @internal */ final class IssueTest extends TestCase { - /** @dataProvider provideIncomplete */ + #[DataProvider('provideIncomplete')] public function testIncompleteByDataProvider(): void { } @@ -20,7 +21,7 @@ public static function provideIncomplete(): void self::markTestIncomplete('foo'); } - /** @dataProvider provideSkipped */ + #[DataProvider('provideSkipped')] public function testSkippedByDataProvider(): void { } @@ -30,7 +31,7 @@ public static function provideSkipped(): void self::markTestSkipped('bar'); } - /** @dataProvider provideError */ + #[DataProvider('provideError')] public function testErrorByDataProvider(): void { } diff --git a/test/fixtures/paratest_only_tests/EnvironmentTest.php b/test/fixtures/paratest_only_tests/EnvironmentTest.php index 80dc855b..d1c70987 100644 --- a/test/fixtures/paratest_only_tests/EnvironmentTest.php +++ b/test/fixtures/paratest_only_tests/EnvironmentTest.php @@ -4,6 +4,7 @@ namespace ParaTest\Tests\fixtures\paratest_only_tests; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function getenv; @@ -12,7 +13,7 @@ /** @internal */ final class EnvironmentTest extends TestCase { - /** @group fixtures */ + #[Group('fixtures')] public function testParatestVariableIsDefined(): void { $this->assertEquals(1, getenv('PARATEST')); diff --git a/test/fixtures/special_chars/UnitTestWithDataProviderSpecialCharsTest.php b/test/fixtures/special_chars/UnitTestWithDataProviderSpecialCharsTest.php index f25f036c..d45a74f0 100644 --- a/test/fixtures/special_chars/UnitTestWithDataProviderSpecialCharsTest.php +++ b/test/fixtures/special_chars/UnitTestWithDataProviderSpecialCharsTest.php @@ -4,6 +4,7 @@ namespace ParaTest\Tests\fixtures\special_chars; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function array_map; @@ -12,7 +13,7 @@ final class UnitTestWithDataProviderSpecialCharsTest extends TestCase { - /** @dataProvider provideSpecialChars */ + #[DataProvider('provideSpecialChars')] public function testIsItFalse(string $specialChar): void { self::assertFalse($specialChar, (string) ord($specialChar));