Newer
Older
/**
* SPIP, Système de publication pour l'internet
*
* Copyright © avec tendresse depuis 2001
* Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James
*
* Ce programme est un logiciel libre distribué sous licence GNU/GPL.
*/
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
namespace Spip\Test\Images\Funct;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class CouleurExtraireTest extends TestCase
{
public static function setUpBeforeClass(): void {
find_in_path('filtres/couleurs.php', '', true);
}
#[DataProvider('providerCouleurExtraire')]
public function testCouleurExtraire($expected, ...$args): void {
$actual = couleur_extraire(...$args);
$this->assertSame($expected, $actual);
}
public static function providerCouleurExtraire(): array {
return [
'valeur_par_défaut' =>
[
0 => 'F26C4E',
1 => '',
],
'extraction_image_chemin_relatif' =>
[
0 => '739cc8',
1 => find_in_path('tests/data/degrade-bleu.jpg'),
],
# Echoue si https local mal configuré
/*'extraction_image_absolu' =>
[
0 => '739cc8',
1 => url_absolue(find_in_path('tests/data/degrade-bleu.jpg'), $GLOBALS['meta']['adresse_site'] . '/'),
],*/
];
}
}