Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Regard whitespace Rev 946 → Rev 947

/trunk/services/tests/0.1/ServiceEflorePhpUnit.php
14,6 → 14,7
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
 
abstract class ServiceEflorePhpUnit extends PHPUnit_Framework_TestCase {
 
/** Définir la valeur de cet attribut dans le constructeur de la classe de test.*/
49,6 → 50,8
}
 
private static function chargerFramework() {
static $cheminRacine;
if(!$cheminRacine) {
$cheminRacine = realpath(dirname(__FILE__).'/../..').'/';
$framework = $cheminRacine.'framework.php';
if (!file_exists($framework)) {
57,11 → 60,11
} else {
// Inclusion du Framework
require_once $framework;
 
// Ajout d'information concernant cette application
Framework::setCheminAppli($cheminRacine);// Obligatoire
}
}
}
 
//+------------------------------------------------------------------------------------------------------+
// Refactorisation
/trunk/services/tests/0.1/baseflor/InformationsBaseflorTest.php
98,7 → 98,7
$ressources = array();
$parametresList = array(
array('navigation.depart' => -5, 'navigation.limite' => 10 ),
array('navigation.depart' => 0, 'navigation.limite' => abc ));
array('navigation.depart' => 0, 'navigation.limite' => 'abc' ));
$cles = array('navigation.depart','navigation.limite');
$i = 0 ;
foreach ($parametresList as $parametres) {
147,10 → 147,10
$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
$this->assertArrayHasKey('entete', $retour, "Le json ne contient pas d'attribut : entete. Voir : $url");
$this->assertArrayHasKey('resultats', $retour, "Le json ne contient pas d'attribut : resultat. Voir : $url");
$this->verifierJsonEnteteBienFormeInformations($retour, $parametres);
$this->verifierJsonEnteteBienFormeInformations($retour, $ressources, $parametres);
}
private function verifierJsonEnteteBienFormeInformations($retour, $parametres) {
private function verifierJsonEnteteBienFormeInformations($retour, $ressources, $parametres) {
//depart
$this->assertArrayHasKey('depart', $retour['entete'],
"L'en-tête ne contient pas d'attribut : depart ");
194,6 → 194,7
public function testJsonNombreLimiteDemande() {
$ressources = array();
$parametres = array();
$parametresList = array('navigation.depart' => 10, 'navigation.limite' => 15 );
$url = ServiceEflorePhpUnit::creerUrl($this->service, $ressources, $parametres);
$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
245,19 → 246,12
public function testJsonInformationsNNBasefor_max() {
$ressources = array('bdtfx.nn:73256');
$parametresList = array(
array('retour.format' => 'max', 'categorie' => 'description'),
array('retour.format' => 'max' , 'categorie' => 'ecologie'));
foreach ($parametresList as $parametres) {
$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
if ($parametres['categorie'] == 'description') {
$retour = $this->consulterJson($this->service, $this->projet, ['bdtfx.nn:73256'], ['retour.format' => 'max', 'categorie' => 'description']);
$this->verifierParametresDescription_max($retour);
} else {
 
$retour = $this->consulterJson($this->service, $this->projet, ['bdtfx.nn:73256'], ['retour.format' => 'max', 'categorie' => 'ecologie']);
$this->verifierParametresEcologie_max($retour, 'baseflor');
}
}
}
public function testJsonInformationsNNRangSup_max() {
$ressources = array('bdtfx.nn:101128');
335,6 → 329,7
 
public function testRelationsCatminat() {
$ressources = array('bdtfx.nn:5641', 'relations', 'catminat');
$parametres = array();
$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
 
// valeurs standards
/trunk/services/tests/0.1/nvjfl/NvjflNomsVernaTest.php
26,7 → 26,7
 
$retour = ServiceEflorePhpUnit::consulterBrut($this->service, $this->projet, $ressources, $parametres);
 
$attendu = 'La requête SQL formée comporte une erreur!';
$attendu = "La table recherchée n'existe pas";
$message = "L'url :\n'$url'\n doit retourner un résultat de la forme :\n $attendu";
$this->assertEquals($attendu, $retour, $message);
}