324 |
delphine |
1 |
<?php
|
|
|
2 |
require_once dirname(__FILE__).'/../ServiceEflorePhpUnit.php';
|
|
|
3 |
|
|
|
4 |
class EfloreCartesTest extends ServiceEflorePhpUnit {
|
|
|
5 |
|
|
|
6 |
private $retour = '';
|
|
|
7 |
private $map = '';
|
|
|
8 |
|
|
|
9 |
public function __construct() {
|
|
|
10 |
$this->projet = 'eflore';
|
|
|
11 |
$this->service = 'cartes';
|
|
|
12 |
}
|
|
|
13 |
|
|
|
14 |
public function setUp() {
|
|
|
15 |
$this->retour = '';
|
|
|
16 |
$this->map = '';
|
|
|
17 |
}
|
|
|
18 |
|
|
|
19 |
public function testCarteGenerale() {
|
|
|
20 |
$ressources = array();//nn = 141; nt = 8522; nom = 'Acer campestre L.'; nom_ss_auteur = 'Acer campestre'
|
|
|
21 |
$parametres = array('projet' => 'general', 'masque.nn' => '141', 'masque.nt' => '8522',
|
|
|
22 |
'masque.ns' => 'Acer campestre', 'masque.au' => 'L.', 'retour' => 'text/html');
|
|
|
23 |
|
|
|
24 |
$this->retour = $this->consulterBrut($ressources, $parametres);
|
|
|
25 |
$this->assertNotEmpty($this->retour, $this->retour);
|
|
|
26 |
$this->assertContains('<img', $this->retour, 'doit contenir une balise image');
|
|
|
27 |
$this->assertContains('nt8522_france_utm_600x564.png', $this->retour, 'l\'adresse doit se terminer par nt8522_france_utm_600x564.png');
|
|
|
28 |
$this->assertContains('<map', $this->retour, 'doit contenir une balise map');
|
|
|
29 |
$this->assertContains('CEL', $this->retour, 'doit contenir une observation CEL');
|
|
|
30 |
$this->assertContains('SOPHY', $this->retour, 'doit contenir une observation SOPHY');
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
public function testCarteGeneriqueLegende() {
|
|
|
34 |
$ressources = array('legende');
|
|
|
35 |
$parametres = array();
|
|
|
36 |
|
|
|
37 |
$this->retour = $this->consulterJson($ressources, $parametres);
|
|
|
38 |
$this->assertNotEmpty($this->retour);
|
|
|
39 |
$this->assertGreaterThanOrEqual(4, count($this->retour), 'doit contenir au - les légendes de cel, cen-lr, sophy et plusieurs'.$this->retour);
|
|
|
40 |
$this->assertArrayHasKey('code', $this->retour[0], 'contient le code du projet');
|
|
|
41 |
$this->assertArrayHasKey('couleur', $this->retour[0], 'contient le code couleur correspondant');
|
|
|
42 |
$this->assertArrayHasKey('nom', $this->retour[0], 'contient le nom du projet');
|
|
|
43 |
$this->assertArrayHasKey('description', $this->retour[0], 'contient une desctiption du projet');
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
private function verifierPresenceMessage($messageAttendu) {
|
|
|
48 |
$this->assertEquals($messageAttendu, $this->retour);
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
}
|
|
|
52 |
?>
|