Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 323 → Rev 324

/trunk/services/tests/0.1/eflore/EfloreCartesTest.php
New file
0,0 → 1,52
<?php
require_once dirname(__FILE__).'/../ServiceEflorePhpUnit.php';
 
class EfloreCartesTest extends ServiceEflorePhpUnit {
 
private $retour = '';
private $map = '';
 
public function __construct() {
$this->projet = 'eflore';
$this->service = 'cartes';
}
 
public function setUp() {
$this->retour = '';
$this->map = '';
}
 
public function testCarteGenerale() {
$ressources = array();//nn = 141; nt = 8522; nom = 'Acer campestre L.'; nom_ss_auteur = 'Acer campestre'
$parametres = array('projet' => 'general', 'masque.nn' => '141', 'masque.nt' => '8522',
'masque.ns' => 'Acer campestre', 'masque.au' => 'L.', 'retour' => 'text/html');
 
$this->retour = $this->consulterBrut($ressources, $parametres);
$this->assertNotEmpty($this->retour, $this->retour);
$this->assertContains('<img', $this->retour, 'doit contenir une balise image');
$this->assertContains('nt8522_france_utm_600x564.png', $this->retour, 'l\'adresse doit se terminer par nt8522_france_utm_600x564.png');
$this->assertContains('<map', $this->retour, 'doit contenir une balise map');
$this->assertContains('CEL', $this->retour, 'doit contenir une observation CEL');
$this->assertContains('SOPHY', $this->retour, 'doit contenir une observation SOPHY');
}
 
public function testCarteGeneriqueLegende() {
$ressources = array('legende');
$parametres = array();
 
$this->retour = $this->consulterJson($ressources, $parametres);
$this->assertNotEmpty($this->retour);
$this->assertGreaterThanOrEqual(4, count($this->retour), 'doit contenir au - les légendes de cel, cen-lr, sophy et plusieurs'.$this->retour);
$this->assertArrayHasKey('code', $this->retour[0], 'contient le code du projet');
$this->assertArrayHasKey('couleur', $this->retour[0], 'contient le code couleur correspondant');
$this->assertArrayHasKey('nom', $this->retour[0], 'contient le nom du projet');
$this->assertArrayHasKey('description', $this->retour[0], 'contient une desctiption du projet');
}
 
private function verifierPresenceMessage($messageAttendu) {
$this->assertEquals($messageAttendu, $this->retour);
}
 
}
?>