✨ Story 4.5: temoignages
This commit is contained in:
26
tests/testimonials.test.php
Normal file
26
tests/testimonials.test.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../includes/functions.php';
|
||||
|
||||
function assertTrue($cond, $msg) {
|
||||
if (!$cond) {
|
||||
fwrite(STDERR, $msg . PHP_EOL);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$testimonials = getTestimonials();
|
||||
assertTrue(count($testimonials) === 3, 'expected 3 testimonials');
|
||||
|
||||
$featured = getFeaturedTestimonials();
|
||||
assertTrue(count($featured) === 2, 'expected 2 featured');
|
||||
|
||||
$byProject = getTestimonialByProject('ecommerce-xyz');
|
||||
assertTrue(is_array($byProject), 'missing project testimonial');
|
||||
|
||||
$missing = getTestimonialByProject('inexistant');
|
||||
assertTrue($missing === null, 'expected null for missing testimonial');
|
||||
|
||||
$content = file_get_contents(__DIR__ . '/../pages/home.php');
|
||||
assertTrue(strpos($content, 'Ils m\'ont fait confiance') !== false, 'missing home featured section');
|
||||
|
||||
fwrite(STDOUT, "OK\n");
|
||||
Reference in New Issue
Block a user