Story 3.3: liste projets vedettes

This commit is contained in:
2026-02-04 17:08:47 +01:00
parent 0409bb1327
commit 136cdf1736
6 changed files with 136 additions and 32 deletions

View 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");

View File

@@ -11,4 +11,5 @@ $here = Split-Path -Parent $MyInvocation.MyCommand.Path
& (Join-Path $here 'router.test.ps1')
php (Join-Path $here 'projects.test.php')
php (Join-Path $here 'router.test.php')
php (Join-Path $here 'projects-list.test.php')
'OK'