✨ Story 4.1: page competences
This commit is contained in:
23
tests/skills.test.php
Normal file
23
tests/skills.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);
|
||||
}
|
||||
}
|
||||
|
||||
$counts = getProjectCountByTech();
|
||||
assertTrue(is_array($counts), 'counts not array');
|
||||
assertTrue(($counts['PHP'] ?? 0) >= 1, 'expected PHP count');
|
||||
|
||||
$projects = getProjectsByTech('PHP');
|
||||
assertTrue(is_array($projects), 'projectsByTech not array');
|
||||
assertTrue(count($projects) >= 1, 'expected projects by tech');
|
||||
|
||||
$content = file_get_contents(__DIR__ . '/../pages/skills.php');
|
||||
assertTrue(strpos($content, 'Compétences') !== false, 'skills page missing title');
|
||||
assertTrue(strpos($content, '/projets?tech=') !== false, 'skills page missing tech links');
|
||||
|
||||
fwrite(STDOUT, "OK\n");
|
||||
Reference in New Issue
Block a user