Réparer les scripts intégrés aux vues

This commit is contained in:
Alexandre NOEL 2026-09-03 23:08:03 +02:00
commit 64ce1285aa
12 changed files with 112 additions and 97 deletions

View file

@ -414,6 +414,22 @@ try {
(bool) $db->query('SELECT revoked_at FROM trusted_devices WHERE id=' . (int) $device['id'])->fetchColumn(),
);
});
$test('Les vues ne contiennent aucune balise PHP déformée', function () use ($root, $assert): void {
$views = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root . '/app/Views'));
foreach ($views as $view) {
if (!$view->isFile() || $view->getExtension() !== 'php') {
continue;
}
$contents = file_get_contents($view->getPathname());
$assert($contents !== false, 'Vue illisible : ' . $view->getFilename());
foreach (['< ? =', '? >', ' - > '] as $brokenToken) {
$assert(
!str_contains($contents, $brokenToken),
'Syntaxe déformée dans ' . $view->getFilename() . ' : ' . $brokenToken,
);
}
}
});
$test('La démonstration installe une fiche Twix complète', function () use ($db, $root, $assert): void {
DemoDataService::reset($db);
$summary = DemoDataService::seed($db, Auth::id());