Subversion Repositories Applications.referentiel

Compare Revisions

Ignore whitespace Rev 29 → Rev 30

/trunk/scripts/modules/tests/Tests.php
18,30 → 18,48
class Tests extends ScriptCommande {
private $projet = null;
private $traitement = null;
private $manuel = null;
private $resultatDao = null;
private $traitementDao = null;
private $tableStructureDao = null;
private $referentielDao = null;
public function executer() {
// Récupération de paramêtres
$this->projet = $this->getParam('p');
$this->manuel = parse_ini_file($this->getModuleChemin().DS.'configurations'.DS.'referentiel_v2.1.ini');
$traitementDao = new TraitementDao();
$traitement = $traitementDao->getDernierTraitement($this->projet);
Debug::printr($traitement);
Debug::printr('Debute:'.$traitementDao->debuterTraitement($traitement['id_traitement']));
$traitements_obsoletes = $traitementDao->getTraitementsObsoletes($this->projet);
Debug::printr('Supp. obsoletes:'.$traitementDao->supprimer($traitements_obsoletes));
$this->resultatDao = new ResultatDao();
$this->traitementDao = new TraitementDao();
// Récupération du dernier traitement demandé
$this->traitement = $this->traitementDao->getDernierTraitement($this->projet);
Debug::printr($this->traitement);
// Écriture de la date de début du traitement
Debug::printr('Debute:'.$this->traitementDao->debuterTraitement($this->traitement['id_traitement']));
// Nettoyage des traitements obsolètes
$traitements_obsoletes = $this->traitementDao->getTraitementsObsoletes($this->projet);
Debug::printr('Supp. obsoletes:'.$this->traitementDao->supprimer($traitements_obsoletes));
// TODO : Nettoyage des tratiements (et de leurs résultats) avortés
// Lancement du test demandé
$cmd = $this->getParam('a');
switch ($cmd) {
case 'tout' :
$this->tableStructureDao = new TableStructureDao();
$this->referentielDao = new ReferentielDao();
$this->lancerTests();
break;
default :
$this->traiterErreur('Erreur : la commande "%s" n\'existe pas!', array($cmd));
}
// Écriture de la date de fin du traitement
Debug::printr('Debute:'.$this->traitementDao->terminerTraitement($this->traitement['id_traitement']));
}
 
public function lancerTests() {
48,8 → 66,6
$donnees = array();
$donnees['tests'] = array();
/*
// Récupération des données à tester
$colonnes = $this->tableStructureDao->getColonnes($this->projet);
$analyses = $this->tableStructureDao->getAnalyse($this->projet);
58,101 → 74,112
$noms_homonymie = $this->classerNomsParNomComplet($noms);
// Lancement des tests unitaires
$donnees['tests'][] = $this->testerNombreDeChamps($colonnes);
$donnees['tests'][] = $this->testerNomDesChamps($colonnes);
$donnees['tests'][] = $this->testerTypeDesChamps($colonnes);
$donnees['tests'][] = $this->testerTailleDesChamps($colonnes, $analyses);
$donnees['tests'][] = $this->testerNumNomClePrimaire($colonnes);
$this->testerNombreDeChamps($colonnes);
$this->testerNomDesChamps($colonnes);
$this->testerTypeDesChamps($colonnes);
$this->testerTailleDesChamps($colonnes, $analyses);
$this->testerNumNomClePrimaire($colonnes);
$donnees['tests'][] = $this->testerNumNomSuperieurAZero($noms);
$this->testerNumNomSuperieurAZero($noms);
$donnees['tests'][] = $this->testerNumNomRetenuSuperieurAZero($noms);
$donnees['tests'][] = $this->testerNumTaxSupEgalZeroUnique($noms);
$donnees['tests'][] = $this->testerTaxSupPourTaxon($noms);
$donnees['tests'][] = $this->testerExitenceTaxonSuperieur($noms);
$donnees['tests'][] = $this->testerClassificationRang($noms);
$donnees['tests'][] = $this->testerClassification($noms);
$this->testerNumNomRetenuSuperieurAZero($noms);
$this->testerNumTaxSupEgalZeroUnique($noms);
$this->testerTaxSupPourTaxon($noms);
$this->testerExitenceTaxonSuperieur($noms);
$this->testerClassificationRang($noms);
$this->testerClassification($noms);
$donnees['tests'][] = $this->testerRang($noms);
$this->testerRang($noms);
$donnees['tests'][] = $this->testerNomCompletSupraGenerique($noms);
$donnees['tests'][] = $this->testerNomCompletGenre($noms);
$donnees['tests'][] = $this->testerNomCompletInfraGenre($noms);
$donnees['tests'][] = $this->testerNomCompletEspece($noms);
$donnees['tests'][] = $this->testerNomCompletInfraSpecifique($noms);
$this->testerNomCompletSupraGenerique($noms);
$this->testerNomCompletGenre($noms);
$this->testerNomCompletInfraGenre($noms);
$this->testerNomCompletEspece($noms);
$this->testerNomCompletInfraSpecifique($noms);
 
$donnees['tests'][] = $this->testerNomSupraGeneriqueEspaces($noms);
$donnees['tests'][] = $this->testerNomSupraGeneriqueSyntaxe($noms);
$donnees['tests'][] = $this->testerNomSupraGeneriqueRang($noms);
$this->testerNomSupraGeneriqueEspaces($noms);
$this->testerNomSupraGeneriqueSyntaxe($noms);
$this->testerNomSupraGeneriqueRang($noms);
$donnees['tests'][] = $this->testerGenreEspaces($noms);
$donnees['tests'][] = $this->testerGenreSyntaxe($noms);
$donnees['tests'][] = $this->testerGenreRang($noms);
$this->testerGenreEspaces($noms);
$this->testerGenreSyntaxe($noms);
$this->testerGenreRang($noms);
$donnees['tests'][] = $this->testerEpitheteInfraGeneriqueEspaces($noms);
$donnees['tests'][] = $this->testerEpitheteInfraGeneriqueSyntaxe($noms);
$donnees['tests'][] = $this->testerEpitheteInfraGeneriqueRang($noms);
$this->testerEpitheteInfraGeneriqueEspaces($noms);
$this->testerEpitheteInfraGeneriqueSyntaxe($noms);
$this->testerEpitheteInfraGeneriqueRang($noms);
$donnees['tests'][] = $this->testerEpitheteSpEspaces($noms);
$donnees['tests'][] = $this->testerEpitheteSpSyntaxe($noms);
$donnees['tests'][] = $this->testerEpitheteSpRang($noms);
$this->testerEpitheteSpEspaces($noms);
$this->testerEpitheteSpSyntaxe($noms);
$this->testerEpitheteSpRang($noms);
$donnees['tests'][] = $this->testerTypeEpitheteEspaces($noms);
$donnees['tests'][] = $this->testerTypeEpitheteSyntaxe($noms);
$donnees['tests'][] = $this->testerTypeEpitheteHybridite($noms);
$this->testerTypeEpitheteEspaces($noms);
$this->testerTypeEpitheteSyntaxe($noms);
$this->testerTypeEpitheteHybridite($noms);
$donnees['tests'][] = $this->testerEpitheteInfraSpEspaces($noms);
$donnees['tests'][] = $this->testerEpitheteInfraSpSyntaxe($noms);
$donnees['tests'][] = $this->testerEpitheteInfraSpRang($noms);
$this->testerEpitheteInfraSpEspaces($noms);
$this->testerEpitheteInfraSpSyntaxe($noms);
$this->testerEpitheteInfraSpRang($noms);
$donnees['tests'][] = $this->testerGroupeCultivarSyntaxe($noms);
$donnees['tests'][] = $this->testerGroupeCultivarRang($noms);
$this->testerGroupeCultivarSyntaxe($noms);
$this->testerGroupeCultivarRang($noms);
$donnees['tests'][] = $this->testerCultivarSyntaxe($noms);
$donnees['tests'][] = $this->testerCultivarRang($noms);
$this->testerCultivarSyntaxe($noms);
$this->testerCultivarRang($noms);
$donnees['tests'][] = $this->testerNomCommercialSyntaxe($noms);
$donnees['tests'][] = $this->testerNomCommercialPresenceCultivar($noms);
$this->testerNomCommercialSyntaxe($noms);
$this->testerNomCommercialPresenceCultivar($noms);
$donnees['tests'][] = $this->testerAuteurSyntaxe($noms);
$this->testerAuteurSyntaxe($noms);
$donnees['tests'][] = $this->testerAnneeSyntaxe($noms);
$this->testerAnneeSyntaxe($noms);
$donnees['tests'][] = $this->testerBiblioOrigineSyntaxe($noms);
$this->testerBiblioOrigineSyntaxe($noms);
$donnees['tests'][] = $this->testerHomonymieSyntaxe($noms);
$donnees['tests'][] = $this->testerHomonymieExistence($noms, $noms_homonymie);
$this->testerHomonymieSyntaxe($noms);
$this->testerHomonymieExistence($noms, $noms_homonymie);
$donnees['tests'][] = $this->testerBasionymeSyntaxe($noms);
$donnees['tests'][] = $this->testerBasionymeExistence($noms);
$this->testerBasionymeSyntaxe($noms);
$this->testerBasionymeExistence($noms);
$donnees['tests'][] = $this->testerSynonymeProparteSyntaxe($noms);
$donnees['tests'][] = $this->testerSynonymeProparteExistence($noms);
$this->testerSynonymeProparteSyntaxe($noms);
$this->testerSynonymeProparteExistence($noms);
$donnees['tests'][] = $this->testerSynonymeDouteuxSyntaxe($noms);
$this->testerSynonymeDouteuxSyntaxe($noms);
$donnees['tests'][] = $this->testerSynonymeMalAppliqueSyntaxe($noms);
$this->testerSynonymeMalAppliqueSyntaxe($noms);
$donnees['tests'][] = $this->testerSynonymeOrthographiqueSyntaxe($noms);
$donnees['tests'][] = $this->testerSynonymeOrthographiqueExistence($noms);
$this->testerSynonymeOrthographiqueSyntaxe($noms);
$this->testerSynonymeOrthographiqueExistence($noms);
$donnees['tests'][] = $this->testerHybrideParent01Syntaxe($noms);
$donnees['tests'][] = $this->testerHybrideParent01Existence($noms);
$donnees['tests'][] = $this->testerHybrideParent02Syntaxe($noms);
$donnees['tests'][] = $this->testerHybrideParent02Existence($noms);
$this->testerHybrideParent01Syntaxe($noms);
$this->testerHybrideParent01Existence($noms);
$this->testerHybrideParent02Syntaxe($noms);
$this->testerHybrideParent02Existence($noms);
$donnees['tests'][] = $this->testerPresenceSyntaxe($noms);
$donnees['tests'][] = $this->testerStatutOrigineSyntaxe($noms);
$donnees['tests'][] = $this->testerStatutIntroductionSyntaxe($noms);
$donnees['tests'][] = $this->testerStatutCultureSyntaxe($noms);
*/
$this->testerPresenceSyntaxe($noms);
$this->testerStatutOrigineSyntaxe($noms);
$this->testerStatutIntroductionSyntaxe($noms);
$this->testerStatutCultureSyntaxe($noms);
}
//+--------------------------------------------------------------------------------------------------------------+//
// Enregistrement des résultats
private function traiterResultatTest($info) {
if (isset($info['message'])) {
if (is_array($info['message'])) {
$info['message'] = $this->getVue('tests/squelettes/message', $info);
}
}
$this->resultatDao->ajouter($this->traitement['id_traitement'], $info);
}
//+--------------------------------------------------------------------------------------------------------------+//
// TESTS
private function testerStatutCultureSyntaxe($noms) {
$info = array('titre' => 'statut_culture -> syntaxe',
$info = array('nom' => 'statut_culture -> syntaxe',
'description' => "Le champ statut_culture peut contenir :\n".
" - le symbole tiret «-» une autre information non référencée...\n".
" - une première lettre en majuscule indiquant le code standard attribué à ce taxon.\n".
178,11 → 205,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerStatutIntroductionSyntaxe($noms) {
$info = array('titre' => 'statut_introduction -> syntaxe',
$info = array('nom' => 'statut_introduction -> syntaxe',
'description' => "Le champ statut_introduction peut contenir :\n".
" - le symbole tiret «-» une autre information non référencée...\n".
" - une première lettre en majuscule indiquant le code standard attribué à ce taxon.\n".
208,11 → 235,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerStatutOrigineSyntaxe($noms) {
$info = array('titre' => 'statut_origine -> syntaxe',
$info = array('nom' => 'statut_origine -> syntaxe',
'description' => "Le champ statut_origine peut contenir :\n".
" - le symbole tiret «-» une autre information non référencée...\n".
" - une première lettre en majuscule indiquant le code standard attribué à ce taxon.\n".
238,11 → 265,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerPresenceSyntaxe($noms) {
$info = array('titre' => 'presence -> syntaxe',
$info = array('nom' => 'presence -> syntaxe',
'description' => "Le champ presence contient soit :\n".
" - le symbole tiret «-» une autre information non référencée...\n".
" - une première lettre en majuscule indiquant le code standard attribué à ce taxon.\n".
268,11 → 295,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerHybrideParent02Existence($noms) {
$info = array('titre' => 'hybride_parent_02 -> existence',
$info = array('nom' => 'hybride_parent_02 -> existence',
'description' => "Si le champ hybride_parent_02 contient un nombre alors il doit correspondre à une valeur du champ ".
"num_nom.",
'resultat' => false);
295,11 → 322,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerHybrideParent02Syntaxe($noms) {
$info = array('titre' => 'hybride_parent_02 -> syntaxe',
$info = array('nom' => 'hybride_parent_02 -> syntaxe',
'description' => "Le champ hybride_parent_02 contient soit :\n".
" - une valeur vide.\n".
" - un nombre",
323,12 → 350,12
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerHybrideParent01Existence($noms) {
$info = array('titre' => 'hybride_parent_01 -> existence',
$info = array('nom' => 'hybride_parent_01 -> existence',
'description' => "Si le champ hybride_parent_01 contient un nombre alors il doit correspondre à une valeur du champ ".
"num_nom.",
'resultat' => false);
351,11 → 378,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerHybrideParent01Syntaxe($noms) {
$info = array('titre' => 'hybride_parent_01 -> syntaxe',
$info = array('nom' => 'hybride_parent_01 -> syntaxe',
'description' => "Le champ hybride_parent_01 contient soit :\n".
" - une valeur vide.\n".
" - un nombre",
379,11 → 406,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerSynonymeOrthographiqueExistence($noms) {
$info = array('titre' => 'synonyme_orthographique -> existence',
$info = array('nom' => 'synonyme_orthographique -> existence',
'description' => "Si le champ synonyme_orthographique contient un nombre alors il doit correspondre à une valeur du champ ".
"num_nom.",
'resultat' => false);
406,11 → 433,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerSynonymeOrthographiqueSyntaxe($noms) {
$info = array('titre' => 'synonyme_orthographique -> syntaxe',
$info = array('nom' => 'synonyme_orthographique -> syntaxe',
'description' => "Le champ synonyme_orthographique contient soit :\n".
" - une valeur vide.\n".
" - un nombre",
434,11 → 461,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerSynonymeMalAppliqueSyntaxe($noms) {
$info = array('titre' => 'synonyme_mal_applique -> syntaxe',
$info = array('nom' => 'synonyme_mal_applique -> syntaxe',
'description' => "Le champ synonyme_mal_applique contient soit :\n".
" - une valeur vide.\n".
" - le chiffre 1",
462,11 → 489,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerSynonymeDouteuxSyntaxe($noms) {
$info = array('titre' => 'synonyme_douteux -> syntaxe',
$info = array('nom' => 'synonyme_douteux -> syntaxe',
'description' => "Le champ synonyme_douteux contient soit :\n".
" - une valeur vide.\n".
" - le chiffre 1",
490,11 → 517,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerSynonymeProparteExistence($noms) {
$info = array('titre' => 'synonyme_proparte -> existence',
$info = array('nom' => 'synonyme_proparte -> existence',
'description' => "Si le champ synonyme_proparte contient un ou plusieurs nombres alors chacun d'entre eux ".
"doit correspondre à une valeur du champ num_nom.",
'resultat' => false);
524,11 → 551,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerSynonymeProparteSyntaxe($noms) {
$info = array('titre' => 'synonyme_proparte -> syntaxe',
$info = array('nom' => 'synonyme_proparte -> syntaxe',
'description' => "Le champ synonyme_proparte contient soit :\n".
" - une valeur vide.\n".
" - un nombre.\n".
553,11 → 580,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerBasionymeExistence($noms) {
$info = array('titre' => 'basionyme -> existence',
$info = array('nom' => 'basionyme -> existence',
'description' => "Si le champ basionyme contient un nombre alors il doit correspondre à une valeur du champ ".
"num_nom.",
'resultat' => false);
580,11 → 607,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerBasionymeSyntaxe($noms) {
$info = array('titre' => 'basionyme -> syntaxe',
$info = array('nom' => 'basionyme -> syntaxe',
'description' => "Le champ basionyme contient :\n".
" - un nombre ou une valeur vide.\n",
'resultat' => false);
607,11 → 634,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerHomonymieExistence($noms, $noms_homonymie) {
$info = array('titre' => 'homonyme -> existence',
$info = array('nom' => 'homonyme -> existence',
'description' => "Si le champ homonyme contient «1» alors plusieurs noms doivent posséder la même valeur ".
"dans le champ nom_complet.",
'resultat' => false);
634,11 → 661,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerHomonymieSyntaxe($noms) {
$info = array('titre' => 'homonyme -> syntaxe',
$info = array('nom' => 'homonyme -> syntaxe',
'description' => "Le champ homonyme contient :\n".
" - le chiffre 1 ou une valeur vide.\n",
'resultat' => false);
661,11 → 688,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerBiblioOrigineSyntaxe($noms) {
$info = array('titre' => 'biblio_origine -> syntaxe',
$info = array('nom' => 'biblio_origine -> syntaxe',
'description' => "Le champ biblio_origine se compose de plusieurs parties séparées par des caractères ".
"précis qui sont dans l'ordre de gauche à droite :\n".
" - Éventuellement le mot « in » suivi d'un intitulé auteur (utilisé pour indiquer l'intitulé auteur de ".
702,11 → 729,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerAnneeSyntaxe($noms) {
$info = array('titre' => 'annee -> syntaxe',
$info = array('nom' => 'annee -> syntaxe',
'description' => "Le champ annee doit :\n".
" - contenir un nombre de 4 chiffre\n".
" - être supérieur ou égal à 1753 ",
730,11 → 757,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerAuteurSyntaxe($noms) {
$info = array('titre' => 'auteur -> syntaxe',
$info = array('nom' => 'auteur -> syntaxe',
'description' => "Le champ auteur doit :\n".
" - contenir l'intitulé complet des noms de l'auteur ou des auteurs ayant publiés à l'origine la combinaison latine courante.\n".
" - ou débuter par le mot « sensu » et contient l'intitulé complet des noms de l'auteur ou des auteurs ayant publiés un nom dont la description ne correspond pas à celle de l'auteur ou des auteurs d'origine.\n".
766,11 → 793,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNomCommercialSyntaxe($noms) {
$info = array('titre' => 'nom_commercial -> syntaxe',
$info = array('nom' => 'nom_commercial -> syntaxe',
'description' => "Le champ nom_commercial doit contenir un nom commercial conforme aux règles du ".
"Code Internationnal de Nomenclature des Plantes Cultivées (CINPC) ".
"qui se compose de caractères majuscules (A-Z) incluant des signes diacritiques et des espaces.\n",
795,11 → 822,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNomCommercialPresenceCultivar($noms) {
$info = array('titre' => 'nom_commercial -> groupe_cultivar OU cultivar non vide',
$info = array('nom' => 'nom_commercial -> groupe_cultivar OU cultivar non vide',
'description' => "Si le champ nom_commercial contier un nom commercial alors le champ cultivar OU ".
"cultivar_groupe ne doit pas être vide.",
'resultat' => false);
820,11 → 847,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerCultivarSyntaxe($noms) {
$info = array('titre' => 'cultivar -> syntaxe',
$info = array('nom' => 'cultivar -> syntaxe',
'description' => "Le champ cultivar_groupe doit contenir :\n".
" - un nom de cultivar conforme aux règles du Code Internationnal de Nomenclature des Plantes ".
"Cultivées (CINPC) qui se compose de caractères alphanumériques (A-Z,a-z et 0-9) incluant ".
856,11 → 883,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerCultivarRang($noms) {
$info = array('titre' => "cultivar -> rang >= {$this->manuel['rang_genre']}",
$info = array('nom' => "cultivar -> rang >= {$this->manuel['rang_genre']}",
'description' => "Si le champ cultivar n'est pas vide alors le rang du nom doit être supérieur ou égal à {$this->manuel['rang_genre']}.",
'resultat' => false);
882,11 → 909,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerGroupeCultivarSyntaxe($noms) {
$info = array('titre' => 'cultivar_groupe -> syntaxe',
$info = array('nom' => 'cultivar_groupe -> syntaxe',
'description' => "Le champ cultivar_groupe doit contenir un nom de groupe de cultivar conforme aux règles ".
"du code des plantes cultivées qui se compose de caractères alphanumériques (A-Z,a-z et 0-9) incluant ".
"signes diacritiques et marques de ponctuations.\n".
913,11 → 940,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerGroupeCultivarRang($noms) {
$info = array('titre' => "cultivar_groupe -> rang >= {$this->manuel['rang_genre']}",
$info = array('nom' => "cultivar_groupe -> rang >= {$this->manuel['rang_genre']}",
'description' => "Si le champ cultivar_groupe n'est pas vide alors le rang du nom doit être supérieur ou égal à {$this->manuel['rang_genre']}.",
'resultat' => false);
939,11 → 966,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraSpEspaces($noms) {
$info = array('titre' => 'epithete_infra_sp -> espaces en trop',
$info = array('nom' => 'epithete_infra_sp -> espaces en trop',
'description' => "Le champ epithete_infra_sp ne doit pas contenir d'espace avant ou aprés le nom.\n".
"Si des espaces sont compris dans la valeur du champ, il ne doit pas y avoir plusieurs espaces consécutifs.",
'resultat' => false);
967,11 → 994,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraSpSyntaxe($noms) {
$info = array('titre' => 'epithete_infra_sp -> syntaxe',
$info = array('nom' => 'epithete_infra_sp -> syntaxe',
'description' => "Le champ epithete_infra_sp peut contenir :\n".
" - un mot unique composé de lettres minuscules avec ou sans tréma (¨) et de tirets (-). \n".
" Il commence par une lettre minuscule (avec ou sans tréma).\n".
1002,11 → 1029,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraSpRang($noms) {
$info = array('titre' => "epithete_infra_sp -> rang > {$this->manuel['rang_sp']}",
$info = array('nom' => "epithete_infra_sp -> rang > {$this->manuel['rang_sp']}",
'description' => "Si le champ epithete_infra_sp n'est pas vide alors le rang du nom doit être supérieur à {$this->manuel['rang_sp']}.",
'resultat' => false);
1028,11 → 1055,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerTypeEpitheteEspaces($noms) {
$info = array('titre' => 'type_epithete -> espaces en trop',
$info = array('nom' => 'type_epithete -> espaces en trop',
'description' => "Le champ type_epithete ne doit pas contenir d'espace.",
'resultat' => false);
1055,11 → 1082,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerTypeEpitheteSyntaxe($noms) {
$info = array('titre' => 'type_epithete -> syntaxe',
$info = array('nom' => 'type_epithete -> syntaxe',
'description' => "Le champ type_epithete doit contenir un mot unique composé de lettres minuscules sans ".
" accents et de tirets (-). Il commence par une lettre minuscule sans accent.",
'resultat' => false);
1082,11 → 1109,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerTypeEpitheteHybridite($noms) {
$info = array('titre' => 'type_epithete -> hybridité',
$info = array('nom' => 'type_epithete -> hybridité',
'description' => "Le champ type_epithete ne doit pas contenir de préfixe indiquant l'hybridité comme : \n".
" - «n-» \n".
" - «notho-» \n",
1110,24 → 1137,24
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNombreDeChamps($colonnes) {
$info = array('titre' => 'Structure -> nombre de champs : %s',
$info = array('nom' => 'Structure -> nombre de champs',
'description' => 'Le nombre de champs présent dans la table doit être supérieur ou égal à 35.',
'resultat' => false);
$nbre_colonnes = count($colonnes);
$info['titre'] = sprintf($info['titre'], $nbre_colonnes);
$info['message'] = $nbre_colonnes;
if ($nbre_colonnes >= 35) {
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNomDesChamps($colonnes) {
$info = array('titre' => 'Structure -> noms des champs',
$info = array('nom' => 'Structure -> noms des champs',
'description' => 'Les champs de la table contenant le référentiel doivent être conforme à ceux définit par le manuel technique.',
'resultat' => false);
1150,11 → 1177,11
$info['message'] = 'Champs manquant : '.implode(', ', $champs_manquant).'.';
}
return $info;
$this->traiterResultatTest($info);
}
private function testerTypeDesChamps($colonnes) {
$info = array('titre' => 'Structure -> types des champs',
$info = array('nom' => 'Structure -> types des champs',
'description' => 'Les types des champs de la table contenant le référentiel doivent être conforme à ceux définit par le manuel technique.',
'resultat' => false);
1188,11 → 1215,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerTailleDesChamps($colonnes, $analyses) {
$info = array('titre' => 'Structure -> champs tronqués',
$info = array('nom' => 'Structure -> champs tronqués',
'description' => "Vérifie que les données de type texte insérées dans la table n'ont pas été tronquées lors de leur insertion.",
'resultat' => false);
1227,11 → 1254,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNumNomClePrimaire($colonnes) {
$info = array('titre' => 'Structure -> num_nom est clé primaire',
$info = array('nom' => 'Structure -> num_nom est clé primaire',
'description' => "Vérifie que le champ num_nom est bien la clé primaire de la table.",
'resultat' => false);
1241,11 → 1268,11
}
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNumNomSuperieurAZero($noms) {
$info = array('titre' => 'num_nom -> supérieur à 0',
$info = array('nom' => 'num_nom -> supérieur à 0',
'description' => "Le champ num_nom doit contenir des nombres entiers supérieurs à 0.",
'resultat' => false);
1264,11 → 1291,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNumNomRetenuSuperieurAZero($noms) {
$info = array('titre' => 'num_nom_retenu -> supérieur à 0',
$info = array('nom' => 'num_nom_retenu -> supérieur à 0',
'description' => "Le champ num_nom_retenu doit contenir des nombres entiers supérieurs à 0.",
'resultat' => false);
1287,11 → 1314,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNumTaxSupEgalZeroUnique($noms) {
$info = array('titre' => 'num_tax_sup -> égal à 0 unique',
$info = array('nom' => 'num_tax_sup -> égal à 0 unique',
'description' => "Un seul enregistrement doit posséder la valeur 0 dans le champ num_tax_sup. Il correspond au premier taxon de la classification.",
'resultat' => false);
1310,11 → 1337,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerTaxSupPourTaxon($noms) {
$info = array('titre' => 'Classification -> uniquement pour les taxons',
$info = array('nom' => 'Classification -> uniquement pour les taxons',
'description' => "Seul les enregistrements représentant un taxon doivent posséder une valeur dans le champ num_tax_sup.",
'resultat' => false);
1333,11 → 1360,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerExitenceTaxonSuperieur($noms) {
$info = array('titre' => 'Classification -> existence du taxon supérieur',
$info = array('nom' => 'Classification -> existence du taxon supérieur',
'description' => "Pour chaque enregistrement représentant un taxon doit posséder un taxon supérieur sauf la racine de la classification.",
'resultat' => false);
1358,11 → 1385,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerClassificationRang($noms) {
$info = array('titre' => 'Classification -> taxon supérieur avec rang inférieur',
$info = array('nom' => 'Classification -> taxon supérieur avec rang inférieur',
'description' => "Pour chaque enregistrement représentant un taxon, chaque taxon supérieur doit avoir un rang inférieur au taxon courant.",
'resultat' => false);
1386,11 → 1413,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerClassification($noms) {
$info = array('titre' => 'Classification -> racine liée à chaque noeud',
$info = array('nom' => 'Classification -> racine liée à chaque noeud',
'description' => "Pour chaque enregistrement, la classification doit pouvoir être remonté jusqu'à un même nom unique possédant une valeur num_tax_sup de 0.",
'resultat' => false);
1412,7 → 1439,7
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function remonterClassif(&$noms, $nom) {
1426,7 → 1453,7
}
private function testerRang($noms) {
$info = array('titre' => 'rang',
$info = array('nom' => 'rang',
'description' => "Le rang doit correspondre à un valeur numérique définit dans le manuel.",
'resultat' => false);
1447,11 → 1474,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNomCompletSupraGenerique($noms) {
$info = array('titre' => 'nom_complet -> noms supra-génériques',
$info = array('nom' => 'nom_complet -> noms supra-génériques',
'description' => "Si le rang est < à {$this->manuel['rang_genre']} le nom_complet doit correspondre à la valeur du champ nom_supra_generique. ".
"Les valeurs des champs cultivar_groupe, cultivar et nom_commercial peuvent s'y ajouter.",
'resultat' => false);
1478,11 → 1505,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNomCompletGenre($noms) {
$info = array('titre' => 'nom_complet -> noms de genres',
$info = array('nom' => 'nom_complet -> noms de genres',
'description' => "Si le rang est = à {$this->manuel['rang_genre']} le nom_complet doit correspondre à la valeur du champ genre. ".
"Les valeurs des champs cultivar_groupe, cultivar et nom_commercial peuvent s'y ajouter.",
'resultat' => false);
1509,11 → 1536,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNomCompletInfraGenre($noms) {
$info = array('titre' => 'nom_complet -> noms infra-génériques',
$info = array('nom' => 'nom_complet -> noms infra-génériques',
'description' => "Si le rang est > à {$this->manuel['rang_genre']} et < à {$this->manuel['rang_sp']} le nom_complet doit correspondre à une des formules suivantes : \n".
" genre + ' ' + type_epithete + ' ' + epithete_infra_generique \n".
" genre + ' ' + epithete_infra_generique + ' ' + type_epithete=agg. \n".
1551,11 → 1578,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNomCompletEspece($noms) {
$info = array('titre' => "nom_complet -> noms d'espèce",
$info = array('nom' => "nom_complet -> noms d'espèce",
'description' => "Si le rang est = à {$this->manuel['rang_sp']} le nom_complet doit correspondre à la formule : \n".
" genre + ' ' + epithete_sp \n".
"Les valeurs des champs cultivar_groupe, cultivar et nom_commercial peuvent s'y ajouter.",
1584,11 → 1611,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNomCompletInfraSpecifique($noms) {
$info = array('titre' => 'nom_complet -> noms infra-spécifiques',
$info = array('nom' => 'nom_complet -> noms infra-spécifiques',
'description' => "Si le rang est > à {$this->manuel['rang_sp']} le nom_complet doit correspondre à la formule : \n".
" genre + ' ' + epithete_sp + ' ' + type_epithete + ' ' + epithete_infra_generique\n".
"Les valeurs des champs cultivar_groupe, cultivar et nom_commercial peuvent s'y ajouter.",
1619,11 → 1646,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNomSupraGeneriqueEspaces($noms) {
$info = array('titre' => 'nom_supra_generique -> espaces en trop',
$info = array('nom' => 'nom_supra_generique -> espaces en trop',
'description' => "Le champ nom_supra_generique ne doit pas contenir d'espace avant ou aprés le nom.",
'resultat' => false);
1646,11 → 1673,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNomSupraGeneriqueSyntaxe($noms) {
$info = array('titre' => 'nom_supra_generique -> syntaxe',
$info = array('nom' => 'nom_supra_generique -> syntaxe',
'description' => "Le champ nom_supra_generique contient un mot composé de lettres minuscules avec ou sans tréma (¨) et de tirets (-). \n".
"La première lettre (avec ou sans tréma) du mot doit être en majuscule.",
'resultat' => false);
1674,11 → 1701,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerNomSupraGeneriqueRang($noms) {
$info = array('titre' => "nom_supra_generique -> rang < {$this->manuel['rang_genre']}",
$info = array('nom' => "nom_supra_generique -> rang < {$this->manuel['rang_genre']}",
'description' => "Si le champ nom_supra_generique n'est pas vide alors le rang du nom doit être inférieur à {$this->manuel['rang_genre']}.",
'resultat' => false);
1700,11 → 1727,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerGenreEspaces($noms) {
$info = array('titre' => 'genre -> espaces en trop',
$info = array('nom' => 'genre -> espaces en trop',
'description' => "Le champ genre ne doit pas contenir d'espace avant ou aprés le nom.\n".
"Si des espaces sont compris dans la valeur du champ, il ne doit pas y avoir plusieurs espaces consécutifs.",
'resultat' => false);
1728,11 → 1755,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerGenreSyntaxe($noms) {
$info = array('titre' => 'genre -> syntaxe',
$info = array('nom' => 'genre -> syntaxe',
'description' => "Le champ genre peut contenir :\n".
" - un mot unique composé de lettres minuscules avec ou sans tréma (¨) et de tirets (-). \n".
" Il commence par une lettre majuscule (avec ou sans tréma).".
1763,11 → 1790,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerGenreRang($noms) {
$info = array('titre' => "genre -> rang >= {$this->manuel['rang_genre']}",
$info = array('nom' => "genre -> rang >= {$this->manuel['rang_genre']}",
'description' => "Si le champ genre n'est pas vide alors le rang du nom doit être supérieur ou égal à {$this->manuel['rang_genre']}.",
'resultat' => false);
1789,11 → 1816,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraGeneriqueSyntaxe($noms) {
$info = array('titre' => 'epithete_infra_generique -> syntaxe',
$info = array('nom' => 'epithete_infra_generique -> syntaxe',
'description' => "Le champ epithete_infra_generique est composé de lettres minuscules avec ou sans tréma (¨) et de tirets (-). \n".
"La première lettre (avec ou sans tréma) doit être en majuscule.",
'resultat' => false);
1817,11 → 1844,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraGeneriqueRang($noms) {
$info = array('titre' => "epithete_infra_generique -> {$this->manuel['rang_genre']} < rang < {$this->manuel['rang_sp']}",
$info = array('nom' => "epithete_infra_generique -> {$this->manuel['rang_genre']} < rang < {$this->manuel['rang_sp']}",
'description' => "Si le champ epithete_infra_generique n'est pas vide alors le rang du nom doit être compris \n".
"entre {$this->manuel['rang_genre']} et {$this->manuel['rang_sp']}.",
'resultat' => false);
1844,11 → 1871,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraGeneriqueEspaces($noms) {
$info = array('titre' => 'epithete_infra_generique -> espaces en trop',
$info = array('nom' => 'epithete_infra_generique -> espaces en trop',
'description' => "Le champ epithete_infra_generique ne doit pas contenir d'espace avant ou aprés sa valeur.",
'resultat' => false);
1871,11 → 1898,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerEpitheteSpEspaces($noms) {
$info = array('titre' => 'epithete_sp -> espaces en trop',
$info = array('nom' => 'epithete_sp -> espaces en trop',
'description' => "Le champ epithete_sp ne doit pas contenir d'espace avant ou aprés le nom.\n".
"Si des espaces sont compris dans la valeur du champ, il ne doit pas y avoir plusieurs espaces consécutifs.",
'resultat' => false);
1899,11 → 1926,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerEpitheteSpSyntaxe($noms) {
$info = array('titre' => 'epithete_sp -> syntaxe',
$info = array('nom' => 'epithete_sp -> syntaxe',
'description' => "Le champ epithete_sp peut contenir :\n".
" - un mot unique composé de lettres minuscules [a-z] incluant les caractères [ëï-]. \n".
" Il commence par une lettre minuscule [a-zëï].\n".
1935,11 → 1962,11
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
private function testerEpitheteSpRang($noms) {
$info = array('titre' => "epithete_sp -> rang >= {$this->manuel['rang_sp']}",
$info = array('nom' => "epithete_sp -> rang >= {$this->manuel['rang_sp']}",
'description' => "Si le champ epithete_sp n'est pas vide alors le rang du nom doit être supérieur ou égal à {$this->manuel['rang_sp']}.",
'resultat' => false);
1961,7 → 1988,7
$info['resultat'] = true;
}
return $info;
$this->traiterResultatTest($info);
}
//+--------------------------------------------------------------------------------------------------------------+//
/trunk/scripts/modules/tests/configurations/tests.ini
New file
0,0 → 1,5
[titres]
NombreDeChamps = "Structure -> nombre de champs : %s"
 
[descriptions]
NombreDeChamps = "Le nombre de champs présent dans la table doit être supérieur ou égal à 35."
/trunk/scripts/modules/tests/squelettes/message.tpl.html
New file
0,0 → 1,19
<table>
<caption><?=count($test['message']['lignes'])?> lignes en erreur</caption>
<thead>
<tr>
<?php foreach ($test['message']['entete'] as $entete) : ?>
<th><?=$entete?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach ($test['message']['lignes'] as $ligne) : ?>
<tr>
<?php foreach ($ligne as $info) : ?>
<td><?=$info?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
/trunk/scripts/bibliotheque/ScriptCommande.php
20,7 → 20,7
/**
* classe representant une commande
*/
abstract class ScriptCommande {
abstract class ScriptCommande extends Controleur {
 
public $nom;
public $parametres;
65,6 → 65,7
 
function __construct($commande_nom) {
$this->setNom($commande_nom);
parent::__construct();
}
public function __destruct() {