diff --git a/bin/worker.php b/bin/worker.php index f3b6b7b3..f8afa19c 100644 --- a/bin/worker.php +++ b/bin/worker.php @@ -92,7 +92,7 @@ $bootPest = (static function (): void { exit; } - $exitCode = $application->runTest(trim($testPath)); + $exitCode = $application->runTest(realpath(trim($testPath))); fwrite($statusFile, (string) $exitCode); fflush($statusFile); diff --git a/composer.json b/composer.json index f676ea26..df7790ca 100644 --- a/composer.json +++ b/composer.json @@ -41,6 +41,7 @@ "autoload-dev": { "psr-4": { "Tests\\Fixtures\\Covers\\": "tests/Fixtures/Covers", + "Tests\\Fixtures\\Inheritance\\": "tests/Fixtures/Inheritance", "Tests\\": "tests/PHPUnit/" }, "files": [ diff --git a/phpunit.xml b/phpunit.xml index c4d4343e..c626b394 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -18,6 +18,7 @@ ./tests ./tests/.snapshots ./tests/.tests + ./tests/Fixtures/Inheritance diff --git a/tests/.snapshots/allows-to-run-a-directory.txt b/tests/.snapshots/allows-to-run-a-directory.txt index b8903802..f3f68ba6 100644 --- a/tests/.snapshots/allows-to-run-a-directory.txt +++ b/tests/.snapshots/allows-to-run-a-directory.txt @@ -8,4 +8,10 @@ PASS Tests\Fixtures\ExampleTest ✓ it example 2 - Tests: 2 skipped, 2 passed (2 assertions) + WARN Tests\Fixtures\Inheritance\Base\ExampleTest + - example + + PASS Tests\Fixtures\Inheritance\ExampleTest + ✓ example + + Tests: 3 skipped, 3 passed (3 assertions) diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 1db371c3..db60e4ae 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -988,6 +988,7 @@ PASS Tests\Visual\Parallel ✓ parallel + ✓ a parallel test can extend another test with same name PASS Tests\Visual\SingleTestOrDirectory ✓ allows to run a single test @@ -1008,4 +1009,4 @@ PASS Tests\Visual\Version ✓ visual snapshot of help command output - Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 14 skipped, 705 passed (1706 assertions) \ No newline at end of file + Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 14 skipped, 706 passed (1707 assertions) \ No newline at end of file diff --git a/tests/Fixtures/Inheritance/Base/ExampleTest.php b/tests/Fixtures/Inheritance/Base/ExampleTest.php new file mode 100644 index 00000000..5075eb90 --- /dev/null +++ b/tests/Fixtures/Inheritance/Base/ExampleTest.php @@ -0,0 +1,13 @@ +markTestSkipped(); + } +} diff --git a/tests/Fixtures/Inheritance/ExampleTest.php b/tests/Fixtures/Inheritance/ExampleTest.php new file mode 100644 index 00000000..f2469d84 --- /dev/null +++ b/tests/Fixtures/Inheritance/ExampleTest.php @@ -0,0 +1,11 @@ +assertTrue(true); + } +} diff --git a/tests/Fixtures/phpunit-parallel-inheritance.xml b/tests/Fixtures/phpunit-parallel-inheritance.xml new file mode 100644 index 00000000..9aa63bd3 --- /dev/null +++ b/tests/Fixtures/phpunit-parallel-inheritance.xml @@ -0,0 +1,13 @@ + + + + + ./Inheritance + ./Inheritance/Base + + + diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index ab8a20e9..a88dfafc 100644 --- a/tests/Visual/Parallel.php +++ b/tests/Visual/Parallel.php @@ -3,7 +3,9 @@ use Symfony\Component\Process\Process; $run = function () { - $process = new Process(['php', 'bin/pest', '--parallel', '--processes=3', '--exclude-group=integration'], dirname(__DIR__, 2), + $process = new Process( + array_merge(['php', 'bin/pest', '--parallel', '--processes=3'], func_get_args()), + dirname(__DIR__, 2), ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'], ); @@ -15,6 +17,12 @@ $run = function () { }; test('parallel', function () use ($run) { - expect($run())->toContain('Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 11 skipped, 694 passed (1692 assertions)') + expect($run('--exclude-group=integration')) + ->toContain('Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 11 skipped, 694 passed (1692 assertions)') ->toContain('Parallel: 3 processes'); })->skip(PHP_OS_FAMILY === 'Windows'); + +test('a parallel test can extend another test with same name', function () use ($run) { + expect($run('--configuration=tests/Fixtures/phpunit-parallel-inheritance.xml')) + ->toContain('1 passed'); +});