write('tests/Integration/WelcomeTest.php', <<<'PHP' greet('visitor'))->toBe('Hello, visitor!'); }); PHP); $project->git()->commit('add a test file the graph does not know'); } test('a replay records a test file the graph does not know', function (array $arguments): void { $project = Project::make('master'); addTestFileTheGraphDoesNotKnow($project); $project->seed('master'); $first = $project->pest('--tia', ...$arguments); expect($first->exitCode)->toBe(0, $first->describe()) ->and($first->replayed())->toBe(Project::TOTAL_TESTS, $first->describe()) ->and($first->uncached())->toBe(1, $first->describe()) ->and($project->graph()['edges'] ?? [])->toHaveKey('tests/Integration/WelcomeTest.php'); $second = $project->pest('--tia', ...$arguments); expect($second->exitCode)->toBe(0, $second->describe()) ->and($second->replayed())->toBe(Project::TOTAL_TESTS + 1, $second->describe()) ->and($second->uncached())->toBe(0, $second->describe()); })->with(Project::SEQUENTIAL_AND_PARALLEL)->skipOnWindows()->skip(! Coverage::isAvailable(), 'Coverage is not available'); test('a replay that records a test file the graph does not know keeps the edges of the known test files', function (array $arguments): void { $project = Project::make('master'); addTestFileTheGraphDoesNotKnow($project); $project->seed('master', failing: ['greets a person']); $project->mutateGraph(function (array $graph): array { $graph['edges']['tests/Unit/GreeterTest.php'][] = array_search('app/Calculator.php', $graph['files'], true); return $graph; }); $known = $project->graph()['edges'] ?? []; $result = $project->pest('--tia', ...$arguments); $edges = $project->graph()['edges'] ?? []; expect($result->exitCode)->toBe(0, $result->describe()) ->and($edges)->toHaveKey('tests/Integration/WelcomeTest.php'); unset($edges['tests/Integration/WelcomeTest.php']); expect($edges)->toBe($known); })->with(Project::SEQUENTIAL_AND_PARALLEL)->skipOnWindows()->skip(! Coverage::isAvailable(), 'Coverage is not available');