Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 948 → Rev 949

/trunk/services/modules/0.1/moissonnage/cartes/SourceDonnees.php
102,7 → 102,7
"FROM {$source}_tapir WHERE ".$this->construireWhereTaxonMoissonnage()." ".
"AND lieu_station_longitude BETWEEN ".$this->limitesCarte['ouest']." AND ".$this->limitesCarte['est']." ".
"AND lieu_station_latitude BETWEEN ".$this->limitesCarte['sud']." AND ".$this->limitesCarte['nord']." ".
"AND Length(lieu_commune_code_insee)=5 ORDER BY lieu_commune_code_insee, date"." -- " . __FILE__ . ":" . __LINE__." ".$_SERVER['REQUEST_URI'];
"AND Length(lieu_commune_code_insee)=5 ORDER BY lieu_commune_code_insee, date"." -- " . __FILE__ . ":" . __LINE__." ". @$_SERVER['REQUEST_URI'];
$stations = $this->bdd->recupererTous($requete);
$this->rechercherInfosCommune($stations);
return $stations;
/trunk/services/modules/0.1/cel/Images.php
57,7 → 57,7
 
$resultat = new ResultatService();
if ($this->parametres['retour'] == self::MIME_JPEG) {
if ($this->parametres['retour.tri'] == 'date') { // recherche la plus vieille image du CEL
if (@$this->parametres['retour.tri'] == 'date') { // recherche la plus vieille image du CEL
$id_image_a_renvoyer = $this->obtenirIdPremiereImage();
} else {
$id_image_a_renvoyer = $this->obtenirIdImageAuHasard();
231,8 → 231,8
'FROM cel_obs_images AS coi '.
' LEFT JOIN cel_obs AS co '.
'ON (coi.id_observation = co.id_observation) '.
'WHERE ci.transmission = 1 '.
" AND ci.nom_ret_nn IN ($numNom)";
'WHERE co.transmission = 1 '.
" AND co.nom_ret_nn IN ($numNom)";
" AND co.nom_referentiel = ".$this->Bdd->proteger($refTax) . ' -- ' . __FILE__ . ':' . __LINE__;
 
$resultat = $this->Bdd->recupererTous($requete);
/trunk/services/tests/0.1/ServiceEflorePhpUnit.php
2,9 → 2,9
// declare(encoding='UTF-8');
/**
* Classe contenant des méthodes :
* - d'intialisation des tests,
* - refactorisant le code des tests,
* - facilitant les tests.
* - d'intialisation des tests,
* - refactorisant le code des tests,
* - facilitant les tests.
*
* @category php 5.3
* @package Tests/Services
51,20 → 51,20
 
private static function chargerFramework() {
static $cheminRacine;
if(!$cheminRacine) {
$cheminRacine = realpath(dirname(__FILE__).'/../..').'/';
$framework = $cheminRacine.'framework.php';
if (!file_exists($framework)) {
$e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
trigger_error($e, E_USER_ERROR);
} else {
// Inclusion du Framework
require_once $framework;
// Ajout d'information concernant cette application
Framework::setCheminAppli($cheminRacine);// Obligatoire
}
}
}
if(!$cheminRacine) {
$cheminRacine = realpath(dirname(__FILE__).'/../..').'/';
$framework = $cheminRacine.'framework.php';
if (!file_exists($framework)) {
$e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
trigger_error($e, E_USER_ERROR);
} else {
// Inclusion du Framework
require_once $framework;
// Ajout d'information concernant cette application
Framework::setCheminAppli($cheminRacine);// Obligatoire
}
}
}
 
//+------------------------------------------------------------------------------------------------------+
// Refactorisation
87,9 → 87,7
static function creerUrl($service, $ressources, $parametres = NULL) {
// TODO ? $version
$ressourcesUrl = array();
foreach ($ressources as $ressource) {
$ressourcesUrl[] = $ressource;
}
if($ressources) foreach ($ressources as $ressource) $ressourcesUrl[] = $ressource;
$ressourcesUrl = count($ressourcesUrl) > 0 ? '/'.implode('/', $ressourcesUrl) : '';
 
$parametresUrl = '';
109,8 → 107,8
/**
* Récupère un bouchon de classe abstraite.
* Comment l'utiliser :
* $classeAstraite = $this->getClasseAbstraite('MaClasse', array('param1', 'param2'));
* $foo = $classeAstraite->methodeConcretePublique();
* $classeAstraite = $this->getClasseAbstraite('MaClasse', array('param1', 'param2'));
* $foo = $classeAstraite->methodeConcretePublique();
*
* @param String $classeNom Le nom de la classe
* @param Array $parametres Les paramètres à passer au constructeur.
124,10 → 122,10
/**
* Récupère une méthode privée d'une classe pour tester/documenter.
* Comment l'utiliser :
* MyClass->foo():
* $cls = new MyClass();
* $foo = self::getPrivateMethode($cls, 'foo');
* $foo->invoke($cls, $...);
* MyClass->foo():
* $cls = new MyClass();
* $foo = self::getPrivateMethode($cls, 'foo');
* $foo->invoke($cls, $...);
*
* @param object $objet Une instance de votre classe
* @param string $methode Le nom de la méthode private
143,10 → 141,10
/**
* Récupère une méthode protégée d'une classe pour tester/documenter.
* Comment l'utiliser :
* MyClass->foo():
* $cls = new MyClass();
* $foo = self::getProtectedMethode($cls, 'foo');
* $foo->invoke($cls, $...);
* MyClass->foo():
* $cls = new MyClass();
* $foo = self::getProtectedMethode($cls, 'foo');
* $foo->invoke($cls, $...);
* @param object $objet Une instance de votre classe
* @param string $methode Le nom de la méthode protected
* @return ReflectionMethod La méthode demandée
154,6 → 152,12
public static function getMethodeProtegee($objet, $nomMethode) {
return self::getMethodePrivee($objet, $nomMethode);
}
 
public function assertArrayHasKeys(array $keys, array $array, $message = null) {
foreach ($keys as $key) {
$this->assertArrayHasKey($key, $array, $message);
}
}
}
 
/*
/trunk/services/tests/0.1/baseflor/InformationsBaseflorTest.php
217,7 → 217,7
"Le champs 'type_bio.libelle' ne doit pas être présent si retour.format=min.");
$this->assertArrayNotHasKey('type_bio.detail',$retour,
"Le champs 'type_bio.detail' ne doit pas être présent si retour.format=min.");
$champs = array_keys(config::get('champs_ontologiques'));
$champs = array_keys(Outils::recupererTableauConfig('champs_ontologiques'));
foreach ($champs as $chps) {
$this->assertArrayNotHasKey($chps.'.libelle', $retour,
"Le champs '{$chps}.libelle' ne doit pas être présent si retour.format=min.");
274,7 → 274,7
}
private function verifierParametresEcologie_max($retour,$type) {
$champs = array_keys(config::get('champs_ontologiques'));
$champs = array_keys(Outils::recupererTableauConfig('champs_ontologiques'));
if ($type == 'baseflor') {
foreach ($champs as $chps) {
$this->assertArrayHasKey($chps.'.libelle', $retour,
/trunk/services/tests/0.1/coste/CosteNomsTest.php
19,7 → 19,7
$this->commonTestHeader($retour, $url);
$this->assertEquals(1, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 1. Voir : $url");
$this->commonTest($retour, $url, 182);
$this->assertEquals(182, $retour['resultats'][182]['coste:nn'], "error: ['resultats'][$id]['coste:nn']. Voir : $url");
$this->assertEquals(182, $retour['resultats'][182]['coste:nn'], "error: ['resultats'][182]['coste:nn']. Voir : $url");
$this->assertEquals("Roemeria violacea", $retour['resultats'][182]['titre'], "error: ['resultats'][182]['titre']. Voir : $url");
// tag peut peut-être varier à travers les décennies ?
// testRechercheTag ?
/trunk/services/tests/0.1/nvjfl/NvjflNomsVernaTest.php
178,6 → 178,8
$this->assertArrayHasKey('resultat', $retour, "Le json contient pas d'attribut : resultat. Voir : $url");
$this->assertEquals('21', $retour['entete']['total'], "Le json ne contient pas le nombre de valeurs attendues. Voir : $url");
$this->assertArrayHasKey(2081013327, $retour['resultat'], "[resultat] ne contient pas l'élément 2081013327. Voir : $url");
$this->assertArrayHasKeys(['taxon', 'genre', 'conseil_emploi'], $retour['resultat'][2081013327], "[resultat][2081013327] ne contient pas tous les éléments. Voir : $url");
$this->assertEquals('Acer monspessulanum L.', $retour['resultat']['2081013327']['taxon'], "Le json ne contient pas le taxon attendu. Voir : $url");
$this->assertEquals('Masculin singulier', $retour['resultat']['2081013327']['genre'], "Le json ne contient pas le genre attendu pour ce taxon. Voir : $url");
$this->assertEquals('Recommandé ou typique', $retour['resultat']['2081013327']['conseil_emploi'], "Le json ne contient pas le conseil emploi attendu pour ce taxon. Voir : $url");
/trunk/services/tests/0.1/chorodep/ChorodepObservationsTest.php
39,7 → 39,7
$this->assertNotEmpty($retour['entete'], 'pas d\'entete'.print_r($retour['entete'], true));
$this->assertEquals(20, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur '20'. Voir : $url");
$this->assertCount(20, $retour['resultat'], "L'attribut 'total' devrait avoir la valeur '20'. Voir : $url");
$this->assertNotEmpty($retour['resultat']['197:34'], 'resultat 197:34 absent'.print_r($retour['resultat']['74929:03'], true));
$this->assertNotEmpty($retour['resultat']['197:34'], 'resultat 197:34 absent', true);
/*$this->assertArrayHasKey('type', $retour['resultat']['74929:03'], "Le json ne contient pas d'attribut : type. Voir : $url");
$this->assertEquals('chorologie', $retour['resultat']['74929:03']['type'], "L'attribut 'type' devrait avoir la valeur 'chorologie'. Voir : $url");*/
// TODO: implémenter "chorodep/observations/10:25?masque.station=34&retour.format=min"
/trunk/services/tests/0.1/chorodep/ChorodepCartesTest.php
67,7 → 67,6
'retour' => 'image/svg+xml');
 
$this->retour = ServiceEflorePhpUnit::consulterBrut($this->service, $this->projet, $ressources, $parametres);
 
$this->chargerXml();
$this->etreSvg();
$this->verifierDepartementsPresence(array('02', '07', '57', '67', '88', '68', '90', '25', '21', '39', '01', '74', '73', '38', '46', '83'));