Prevent memory exhaustion when generating TIA graphs with PCOV (#1875)

* fix(tia): preserve memory limit during pcov restart

* chore: update test expectations

* fix: stabilize tia replay test in ci
This commit is contained in:
Daniel Polito
2026-08-24 04:41:59 -03:00
committed by GitHub
parent aba2b79609
commit 39cbdcd52b
5 changed files with 52 additions and 9 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
use Pest\Restarters\PcovRestarter;
use Symfony\Component\Process\Process;
it('preserves the active memory limit in the restarted process', function (): void {
$originalMemoryLimit = ini_get('memory_limit');
try {
ini_set('memory_limit', '1234M');
$command = new ReflectionMethod(PcovRestarter::class, 'command')
->invoke(new PcovRestarter, __DIR__, ['-r', 'fwrite(STDOUT, (string) ini_get("memory_limit"));']);
assert(is_array($command));
$process = new Process($command);
$process->mustRun();
expect($process->getOutput())->toBe('1234M');
} finally {
ini_set('memory_limit', (string) $originalMemoryLimit);
}
});