Corriger les liens et la synchronisation i-CAD
This commit is contained in:
parent
7b89fd5dfa
commit
9ff26ad9be
10 changed files with 83 additions and 23 deletions
|
|
@ -215,6 +215,18 @@ try {
|
|||
$assert(strpos($vaccines, 'if ($entryId > 0)') < strpos($vaccines, 'InventoryService::consumeBatch'));
|
||||
$assert(strpos($dewormings, 'if ($entryId > 0)') < strpos($dewormings, 'InventoryService::consumeBatch'));
|
||||
});
|
||||
$test('La liste des vaccins affiche une action de modification explicite', function () use ($assert): void {
|
||||
$medical = file_get_contents(__DIR__ . '/../app/Views/_animal_show_medical.php');
|
||||
$assert(str_contains($medical, "h(t('common.actions'))"), 'L’en-tête Actions manque aux vaccins');
|
||||
$assert(
|
||||
str_contains($medical, 'btn btn-sm btn-outline-primary edit-vaccine'),
|
||||
'Le bouton Modifier des vaccins est absent',
|
||||
);
|
||||
$assert(
|
||||
!preg_match('/class="[^"]*edit-vaccine[^"]*"[\s\S]*?>✏️<\/button>/', $medical),
|
||||
'Le crayon est encore utilisé pour modifier un vaccin',
|
||||
);
|
||||
});
|
||||
$test('Les paramètres sont enregistrés et relus', function () use ($assert): void {
|
||||
AppSettings::save(['association_name' => 'Refuge Test', 'app_language' => 'en'], null);
|
||||
$assert(AppSettings::get('association_name') === 'Refuge Test');
|
||||
|
|
@ -491,6 +503,26 @@ try {
|
|||
$assert($structure !== null && $structure['label'] === 'Structure test');
|
||||
$assert((int) $structure['total_cents'] === 1234);
|
||||
});
|
||||
$test('Le nom de l’adoptant ouvre la bonne route annuaire', function () use ($assert): void {
|
||||
$view = file_get_contents(__DIR__ . '/../app/Views/_animal_show_identity.php');
|
||||
$routes = file_get_contents(__DIR__ . '/../app/Routes/web.php');
|
||||
$assert(
|
||||
str_contains($view, 'href="/directory/view?id=<?= (int)$adoption[\'adopter_contact_id\'] ?>"'),
|
||||
'Le lien de l’adoptant ne cible pas /directory/view',
|
||||
);
|
||||
$assert(!str_contains($view, '/directory/show?id='), 'L’ancienne route annuaire est encore utilisée');
|
||||
$assert(str_contains($routes, "case '/directory/view':"), 'La route /directory/view n’est pas déclarée');
|
||||
});
|
||||
$test('Le rafraîchissement i-CAD fonctionne avec et sans JavaScript', function () use ($assert): void {
|
||||
$identity = file_get_contents(__DIR__ . '/../app/Views/_animal_show_identity.php');
|
||||
$scripts = file_get_contents(__DIR__ . '/../app/Views/_animal_show_modals.php');
|
||||
$controller = file_get_contents(__DIR__ . '/../app/Controllers/AnimalsController.php');
|
||||
$assert(str_contains($identity, 'action="/animal/icad"'), 'Le bouton i-CAD n’a pas de formulaire de secours');
|
||||
$assert(str_contains($identity, 'name="csrf"'), 'Le formulaire i-CAD ne contient pas le jeton CSRF');
|
||||
$assert(str_contains($scripts, "form.addEventListener('submit', refresh)"), 'L’actualisation dynamique i-CAD est absente');
|
||||
$assert(str_contains($scripts, 'if (!r.ok)'), 'Les erreurs HTTP i-CAD ne sont pas contrôlées');
|
||||
$assert(str_contains($controller, "header('Location: /animal?id=' . \$id . '#tab-ident')"), 'Le repli sans JavaScript est absent');
|
||||
});
|
||||
$test('La recherche globale retrouve les dossiers accessibles', function () use ($assert): void {
|
||||
$animals = GlobalSearchService::search('Animal Test');
|
||||
$assert(($animals['animals'][0]['title'] ?? '') === 'Animal Test', 'Animal absent de la recherche');
|
||||
|
|
|
|||
Loading…
Reference in a new issue