diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 378f1a2..29865a0 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -5,6 +5,9 @@ on: ['push', 'pull_request'] permissions: contents: read +env: + COMPOSER_ROOT_VERSION: 5.x-dev + jobs: static: name: Static Tests @@ -26,7 +29,7 @@ jobs: coverage: none - name: Install Dependencies - run: composer update --prefer-stable --no-interaction --no-progress --ansi + run: composer update --${{ matrix.dependency-version }} --no-interaction --no-progress --ansi - name: Types run: composer test:types diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 10af2ce..deda951 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,6 +5,9 @@ on: ['push', 'pull_request'] permissions: contents: read +env: + COMPOSER_ROOT_VERSION: 5.x-dev + jobs: ci: runs-on: ${{ matrix.os }} @@ -37,4 +40,4 @@ jobs: run: composer update --${{ matrix.dependency-version }} --no-interaction --no-progress --ansi - name: Unit Tests - run: composer test:unit + run: composer test:unit -- ${{ matrix.parallel }} diff --git a/phpunit.xml b/phpunit.xml index 7448eb7..146de9f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -5,7 +5,6 @@ beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true" bootstrap="vendor/autoload.php" - cacheResult="false" colors="true" failOnRisky="true" failOnWarning="true" diff --git a/src/Mutators/Abstract/AbstractFunctionCallUnwrapMutator.php b/src/Mutators/Abstract/AbstractFunctionCallUnwrapMutator.php index 455e28a..a12d922 100644 --- a/src/Mutators/Abstract/AbstractFunctionCallUnwrapMutator.php +++ b/src/Mutators/Abstract/AbstractFunctionCallUnwrapMutator.php @@ -44,7 +44,7 @@ public static function mutate(Node $node): Node ]); } - return $node->args[0]->value; + return $node->getArgs()[0]->value; } abstract public static function functionName(): string; diff --git a/src/Mutators/Removal/RemoveEarlyReturn.php b/src/Mutators/Removal/RemoveEarlyReturn.php index 024e199..2e09c57 100644 --- a/src/Mutators/Removal/RemoveEarlyReturn.php +++ b/src/Mutators/Removal/RemoveEarlyReturn.php @@ -44,7 +44,7 @@ public static function can(Node $node): bool if ($classMethod instanceof ClassMethod) { break; } - } while ($classMethod !== null); + } while ($classMethod instanceof Node); if (! $classMethod instanceof ClassMethod) { return false; diff --git a/tests/.pest/snapshots/Visual/Tested/visual_snapshot_of_mutation_tests_on_success.snap b/tests/.pest/snapshots/Visual/MutationOutputTest/visual_snapshot_of_mutation_tests_on_success.snap similarity index 100% rename from tests/.pest/snapshots/Visual/Tested/visual_snapshot_of_mutation_tests_on_success.snap rename to tests/.pest/snapshots/Visual/MutationOutputTest/visual_snapshot_of_mutation_tests_on_success.snap diff --git a/tests/.pest/snapshots/Visual/Untested/visual_snapshot_of_mutation_tests_when_a_mutant_escaped.snap b/tests/.pest/snapshots/Visual/MutationOutputTest/visual_snapshot_of_mutation_tests_when_a_mutant_escaped.snap similarity index 100% rename from tests/.pest/snapshots/Visual/Untested/visual_snapshot_of_mutation_tests_when_a_mutant_escaped.snap rename to tests/.pest/snapshots/Visual/MutationOutputTest/visual_snapshot_of_mutation_tests_when_a_mutant_escaped.snap diff --git a/tests/.pest/snapshots/Visual/TestedWithDescribe/visual_snapshot_of_mutation_tests_on_success.snap b/tests/.pest/snapshots/Visual/MutationOutputTest/visual_snapshot_of_mutation_tests_with_describe_on_success.snap similarity index 100% rename from tests/.pest/snapshots/Visual/TestedWithDescribe/visual_snapshot_of_mutation_tests_on_success.snap rename to tests/.pest/snapshots/Visual/MutationOutputTest/visual_snapshot_of_mutation_tests_with_describe_on_success.snap diff --git a/tests/Helpers.php b/tests/Helpers.php index 612f4bb..71800e7 100644 --- a/tests/Helpers.php +++ b/tests/Helpers.php @@ -18,7 +18,7 @@ function mutationTestOutput(string $fixture): string $process = new Process( ['php', 'vendor/bin/pest', 'tests/.tests/'.$fixture, '--mutate'], dirname(__DIR__), - ['COLUMNS' => 80, 'XDEBUG_MODE' => 'coverage', 'PEST_PLUGIN_INTERNAL_TEST_SUITE' => 1], + ['COLUMNS' => 80, 'XDEBUG_MODE' => 'coverage', 'PEST_PLUGIN_INTERNAL_TEST_SUITE' => 1, 'PARATEST' => false], ); $process->run(); diff --git a/tests/Visual/MutationOutputTest.php b/tests/Visual/MutationOutputTest.php new file mode 100644 index 0000000..a45ab8b --- /dev/null +++ b/tests/Visual/MutationOutputTest.php @@ -0,0 +1,19 @@ +toMatchSnapshot(); +}); + +test('visual snapshot of mutation tests with describe on success', function (): void { + expect(mutationTestOutput('TestedWithDescribe')) + ->toMatchSnapshot(); +}); + +test('visual snapshot of mutation tests when a mutant escaped', function (): void { + expect(mutationTestOutput('Untested')) + ->toMatchSnapshot(); +}); diff --git a/tests/Visual/Tested.php b/tests/Visual/Tested.php deleted file mode 100644 index fa6df07..0000000 --- a/tests/Visual/Tested.php +++ /dev/null @@ -1,8 +0,0 @@ -toMatchSnapshot(); -}); diff --git a/tests/Visual/TestedWithDescribe.php b/tests/Visual/TestedWithDescribe.php deleted file mode 100644 index 59e0ea3..0000000 --- a/tests/Visual/TestedWithDescribe.php +++ /dev/null @@ -1,8 +0,0 @@ -toMatchSnapshot(); -}); diff --git a/tests/Visual/Untested.php b/tests/Visual/Untested.php deleted file mode 100644 index 53d1f32..0000000 --- a/tests/Visual/Untested.php +++ /dev/null @@ -1,8 +0,0 @@ -toMatchSnapshot(); -});