IgnoreNew'
.'PT1MC:/synthetic/php.exe'
.'"C:/synthetic/deadlines.php" --onceC:/synthetic';
}
test('silent deadline correction preserves arguments working directory overlap and limits', function () {
$xml = syntheticDeadlineGuiXml();
$after = DeadlineTaskGuiAction::replacement($xml, 'C:/synthetic/php.exe', 'C:/synthetic/php-win.exe');
expect($after)->toContain('php-win.exe')->toContain('"C:/synthetic/deadlines.php" --once')->toContain('IgnoreNew')->toContain('PT1M');
DeadlineTaskGuiAction::assertConserved($xml, $after, 'C:/synthetic/php.exe', 'C:/synthetic/php-win.exe');
DeadlineTaskGuiAction::assertConserved($xml, str_replace('><', ">\r\n <", $after), 'C:/synthetic/php.exe', 'C:/synthetic/php-win.exe');
expect(DeadlineTaskGuiAction::canonical(str_replace('><', ">\r\n <", $xml)))->toBe(DeadlineTaskGuiAction::canonical($xml));
expect(fn () => DeadlineTaskGuiAction::assertConserved($xml, str_replace('PT1M', 'PT5M', $after), 'C:/synthetic/php.exe', 'C:/synthetic/php-win.exe'))
->toThrow(LogicException::class, 'DEADLINE_TASK_GUI_UNRELATED_DEFINITION_CHANGE');
});
test('silent deadline correction refuses another executable directory or multiple actions', function () {
$xml = syntheticDeadlineGuiXml();
expect(fn () => DeadlineTaskGuiAction::replacement($xml, 'C:/synthetic/php.exe', 'C:/other/php-win.exe'))->toThrow(LogicException::class, 'DEADLINE_TASK_GUI_EXECUTABLE_PAIR');
expect(fn () => DeadlineTaskGuiAction::replacement(str_replace('', 'other', $xml), 'C:/synthetic/php.exe', 'C:/synthetic/php-win.exe'))
->toThrow(LogicException::class, 'DEADLINE_TASK_GUI_ACTION_MISMATCH');
});