diff --git a/src/Restarters/PcovRestarter.php b/src/Restarters/PcovRestarter.php index 3d34ff2f..60422143 100644 --- a/src/Restarters/PcovRestarter.php +++ b/src/Restarters/PcovRestarter.php @@ -81,6 +81,8 @@ final class PcovRestarter implements Restarter '-d', 'memory_limit='.ini_get('memory_limit'), '-d', + 'pcov.enabled='.ini_get('pcov.enabled'), + '-d', 'pcov.directory='.$projectRoot, ], array_values($arguments), diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index f9116164..cbace89f 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -2102,6 +2102,7 @@ PASS Tests\Unit\Restarters\PcovRestarter ✓ it preserves the active memory limit in the restarted process + ✓ it preserves pcov.enabled in the restarted process PASS Tests\Unit\Support\Arr ✓ last → it should return false for an empty arary @@ -2292,4 +2293,4 @@ ✓ pass with dataset with ('my-datas-set-value') ✓ within describe → pass with dataset with ('my-datas-set-value') - Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 36 skipped, 1624 passed (3587 assertions) \ No newline at end of file + Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 36 skipped, 1625 passed (3589 assertions) diff --git a/tests/Unit/Restarters/PcovRestarter.php b/tests/Unit/Restarters/PcovRestarter.php index 84f90046..a139a239 100644 --- a/tests/Unit/Restarters/PcovRestarter.php +++ b/tests/Unit/Restarters/PcovRestarter.php @@ -24,3 +24,15 @@ it('preserves the active memory limit in the restarted process', function (): vo ini_set('memory_limit', (string) $originalMemoryLimit); } }); + +it('preserves pcov.enabled in the restarted process', function (): void { + $command = new ReflectionMethod(PcovRestarter::class, 'command') + ->invoke(new PcovRestarter, __DIR__, []); + + assert(is_array($command)); + + $index = array_search('pcov.enabled='.ini_get('pcov.enabled'), $command, true); + + expect($index)->toBeInt() + ->and($command[$index - 1])->toBe('-d'); +}); diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index 572ff80b..c4a6e5dd 100644 --- a/tests/Visual/Parallel.php +++ b/tests/Visual/Parallel.php @@ -20,7 +20,7 @@ test('parallel', function () use ($run): void { $output = $run('--exclude-group=integration'); $output = implode("\n", array_slice(explode("\n", (string) $output), -10)); - $expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 28 skipped, 1605 passed (3529 assertions)'; + $expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 28 skipped, 1606 passed (3531 assertions)'; expect($output) ->toContain("Tests: {$expected}")