Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 520 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

require_once dirname(__FILE__).'/../ServiceEflorePhpUnit.php';

class OntologiesBaseflorTest extends ServiceEflorePhpUnit {
        
        public function __construct() {
                $this->projet = 'baseflor';
                $this->service = 'ontologies';
        }
        
        public function testRecherche() {
                $ressources = array();
                $parametres = array("navigation.depart" => 20, "navigation.limite" => 100);
                $url = ServiceEflorePhpUnit::creerUrl($this->service, $ressources, $parametres);
                $retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
                $this->assertNotEmpty($retour, 'données absentes');
                //limite
                $this->assertArrayHasKey('limite', $retour['entete'],
                                                        "L'en-tête ne contient pas d'attribut : limite");
                $this->assertEquals($retour['entete']['limite'], $parametres['navigation.limite'],
                                                        "La valeur de limite est incorrecte dans l'en-tête.");
                //total
                $this->assertArrayHasKey('total', $retour['entete'],
                                                        "L'en-tête ne contient pas d'attribut : total ");
                $this->assertEquals('156', $retour['entete']['total'], 
                                                        "L'attribut 'total' devrait avoir la valeur '156. Voir : $url");
                //href
                $this->assertArrayHasKey('href.suivant', $retour['entete'],
                                                        "L'en-tête ne contient pas d'attribut : href.suivant ");
                $this->assertArrayHasKey('href.precedent', $retour['entete'],
                                                                        "L'en-tête ne contient pas d'attribut : href.precedent ");
                $parametres_url =
                array('navigation.depart' => ($retour['entete']['limite']+$retour['entete']['depart']),
                                                                 'navigation.limite' => $retour['entete']['limite'] );
                $urlsuivant = ServiceEflorePhpUnit::creerUrl($this->service, $ressources, $parametres_url);
                $this->assertEquals($urlsuivant, $retour['entete']['href.suivant'],
                                                                                                                "L' url $urlsuivant de l'entete est incorrecte.");
        }
        
        
        
}
?>