This commit is contained in:
nuno maduro
2026-04-23 09:44:12 -07:00
parent e876dba8ba
commit c1feefbb9e
4 changed files with 146 additions and 2 deletions

View File

@ -144,6 +144,32 @@ final class Recorder
$this->currentTestFile = null;
}
/**
* Records an extra source-file dependency for the currently-running
* test. Used by collaborators that capture edges the coverage driver
* cannot see — Blade templates rendered through Laravel's view
* factory are the motivating case (their `.blade.php` source never
* executes directly; a cached compiled PHP file does). No-op when
* the recorder is inactive or no test is in flight, so callers can
* fire it unconditionally from app-level hooks.
*/
public function linkSource(string $sourceFile): void
{
if (! $this->active) {
return;
}
if ($this->currentTestFile === null) {
return;
}
if ($sourceFile === '') {
return;
}
$this->perTestFiles[$this->currentTestFile][$sourceFile] = true;
}
/**
* @return array<string, array<int, string>> absolute test file → list of absolute source files.
*/