Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 844 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?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 = ServiceEflorePhpUnit::consulterBrut($this->service, $this->projet, $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($this->service, $this->projet, $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);
        }

}
?>