| 727 | gduche | 1 | <?php
 | 
        
           | 1360 | raphael | 2 | /*
 | 
        
           |  |  | 3 |  * @author		Grégoire DUCHE <gregoire@tela-botanica.org>
 | 
        
           |  |  | 4 |  * @author		Raphaël Droz <raphael@tela-botanica.org>
 | 
        
           |  |  | 5 |  * @copyright	Copyright (c) 2012, 2013 Tela Botanica (accueil@tela-botanica.org)
 | 
        
           |  |  | 6 |  * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
 | 
        
           |  |  | 7 |  * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
 | 
        
           |  |  | 8 |  *
 | 
        
           |  |  | 9 |  * Classe de test pour /del/services/0.1/images
 | 
        
           |  |  | 10 |  */
 | 
        
           | 727 | gduche | 11 | require_once dirname(__FILE__).'/../ServiceDelPhpUnit.php';
 | 
        
           |  |  | 12 |   | 
        
           | 1360 | raphael | 13 | class ImagesTest extends ServiceDelPhpUnit {
 | 
        
           | 727 | gduche | 14 |   | 
        
           | 1360 | raphael | 15 | 	const nbResultatsGregoire = 409;
 | 
        
           | 727 | gduche | 16 |   | 
        
           |  |  | 17 | 	public function testCoherenceResultat() {
 | 
        
           | 1360 | raphael | 18 | 		$url = $this->creerUrl('images');
 | 
        
           |  |  | 19 | 		$i = new Images();
 | 
        
           |  |  | 20 | 		$retour = $this->consulterDirectJson($i->consulter([], []),
 | 
        
           |  |  | 21 | 											$url);
 | 
        
           | 727 | gduche | 22 |   | 
        
           |  |  | 23 | 		$this->assertArrayHasKey('entete', $retour, "Le json ne contient pas d'attribut : entete. Voir : $url");
 | 
        
           |  |  | 24 | 		$this->assertArrayHasKey('resultats', $retour, "Le json ne contient pas d'attribut : resultat. Voir : $url");
 | 
        
           |  |  | 25 | 	}
 | 
        
           |  |  | 26 |   | 
        
           |  |  | 27 |   | 
        
           |  |  | 28 | 	public function testNbObsEnFonctionDeLauteur() {
 | 
        
           | 1360 | raphael | 29 | 		$parametres = ['masque.auteur' => 'gregoire'];
 | 
        
           | 727 | gduche | 30 |   | 
        
           | 1360 | raphael | 31 | 		$url = $this->creerUrl('images', $parametres);
 | 
        
           |  |  | 32 | 		$i = new Images();
 | 
        
           |  |  | 33 | 		$retour = $this->consulterDirectJson($i->consulter([], $parametres),
 | 
        
           |  |  | 34 | 											$url);
 | 
        
           | 727 | gduche | 35 |   | 
        
           | 1360 | raphael | 36 | 		$this->assertEquals(self::nbResultatsGregoire,
 | 
        
           |  |  | 37 | 							$retour['entete']['total'],
 | 
        
           |  |  | 38 | 							'Le total des observations de Grégoire n\'est pas égal à '.self::nbResultatsGregoire);
 | 
        
           | 727 | gduche | 39 | 	}
 | 
        
           | 1446 | raphael | 40 |   | 
        
           |  |  | 41 |   | 
        
           |  |  | 42 | 	// del:services:0.1/images?navigation.depart=0&navigation.limite=12&tri=date_observation&ordre=asc
 | 
        
           |  |  | 43 | 	// doit avoir 12 éléments
 | 
        
           | 727 | gduche | 44 | }
 | 
        
           |  |  | 45 | ?>
 |