✨ Story 3.3: liste projets vedettes
This commit is contained in:
23
tests/projects-list.test.php
Normal file
23
tests/projects-list.test.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../includes/functions.php';
|
||||
|
||||
function assertTrue($cond, $msg) {
|
||||
if (!$cond) {
|
||||
fwrite(STDERR, $msg . PHP_EOL);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$projects = getProjectsByCategory('vedette');
|
||||
assertTrue(is_array($projects), 'featured projects not array');
|
||||
|
||||
ob_start();
|
||||
foreach ($projects as $project) {
|
||||
include __DIR__ . '/../templates/project-card.php';
|
||||
}
|
||||
$html = ob_get_clean();
|
||||
|
||||
assertTrue(strpos($html, 'badge') !== false, 'missing badges');
|
||||
assertTrue(strpos($html, 'loading="lazy"') !== false, 'missing lazy loading');
|
||||
|
||||
fwrite(STDOUT, "OK\n");
|
||||
Reference in New Issue
Block a user