diff --git a/src/Plugins/Parallel/Paratest/WrapperRunner.php b/src/Plugins/Parallel/Paratest/WrapperRunner.php index 8ea7881a..a200b90d 100644 --- a/src/Plugins/Parallel/Paratest/WrapperRunner.php +++ b/src/Plugins/Parallel/Paratest/WrapperRunner.php @@ -369,7 +369,7 @@ final class WrapperRunner implements RunnerInterface $failedEvents = array_merge_recursive($testResultSum->testFailedEvents(), $testResult->testFailedEvents()); $testResultSum = new TestResult( - (int) $testResultSum->hasTests() + (int) $testResult->hasTests(), + ResultReflection::numberOfTests($testResultSum) + self::numberOfTestsSeenByWorker($testResult), $testResultSum->numberOfTestsRun() + $testResult->numberOfTestsRun(), $testResultSum->numberOfAssertions() + $testResult->numberOfAssertions(), array_merge_recursive($testResultSum->testErroredEvents(), $testResult->testErroredEvents()), @@ -500,6 +500,11 @@ final class WrapperRunner implements RunnerInterface return $exitcode; } + private static function numberOfTestsSeenByWorker(TestResult $result): int + { + return max(ResultReflection::numberOfTests($result), $result->numberOfTestsRun()); + } + /** * @return array{self: non-negative-int, direct: non-negative-int, indirect: non-negative-int, unknown: non-negative-int} */ diff --git a/src/Plugins/Shard.php b/src/Plugins/Shard.php index bb84dd9a..812d9b50 100644 --- a/src/Plugins/Shard.php +++ b/src/Plugins/Shard.php @@ -206,7 +206,7 @@ final class Shard implements AddsOutput, HandlesArguments, Terminable { $filtered = $this->removeParallelArguments($arguments); - return ['php', ...$filtered, '--test-directory='.$testPath, '--list-tests']; + return [PHP_BINARY, ...$filtered, '--test-directory='.$testPath, '--list-tests']; } /** diff --git a/tests/Unit/Plugins/Shard.php b/tests/Unit/Plugins/Shard.php index f31b2cc1..b5f0a8a0 100644 --- a/tests/Unit/Plugins/Shard.php +++ b/tests/Unit/Plugins/Shard.php @@ -367,7 +367,7 @@ describe('buildListTestsCommand', function (): void { $command = $method->invoke($shard, ['bin/pest', '--update-shards'], 'custom/suite'); expect($command)->toBe([ - 'php', + PHP_BINARY, 'bin/pest', '--update-shards', '--test-directory=custom/suite', @@ -385,7 +385,7 @@ describe('buildListTestsCommand', function (): void { $command = $method->invoke($shard, ['bin/pest', '--parallel', '--update-shards', '-p'], 'tests'); expect($command)->toBe([ - 'php', + PHP_BINARY, 'bin/pest', '--update-shards', '--test-directory=tests', @@ -415,7 +415,7 @@ describe('buildListTestsCommand', function (): void { $command = $method->invoke($shard, ['bin/pest', '--parallel', '--processes=4', '--update-shards'], 'tests'); expect($command)->toBe([ - 'php', + PHP_BINARY, 'bin/pest', '--update-shards', '--test-directory=tests',