Subversion Repositories Applications.referentiel

Compare Revisions

Ignore whitespace Rev 64 → Rev 58

/trunk/scripts/modules/tests/Tests.php
24,7 → 24,6
private $traitement = null;
private $manuel = null;
private $noms = null;
private $resultatDao = null;
private $traitementDao = null;
76,119 → 75,104
// Récupération des données à tester
$colonnes = $this->tableStructureDao->getColonnes($this->projet);
$analyses = $this->tableStructureDao->getAnalyse($this->projet);
$this->noms = $this->referentielDao->getTout($this->projet);
Debug::printr('Nbre noms :'.count($this->noms));
$noms = $this->referentielDao->getTout($this->projet);
Debug::printr('Nbre noms :'.count($noms));
$noms = $this->classerNomsParNumNom($noms);
$noms_homonymie = $this->classerNomsParNomComplet($noms);
// Lancement des tests unitaires
$resultats = array();
$resultats[] = $this->testerNombreDeChamps($colonnes);
$resultats[] = $this->testerNomDesChamps($colonnes);
$resultats[] = $this->testerTypeDesChamps($colonnes);
$resultats[] = $this->testerNumNomClePrimaire($colonnes);
$this->testerNombreDeChamps($colonnes);
$this->testerNomDesChamps($colonnes);
$this->testerTypeDesChamps($colonnes);
$this->testerTailleDesChamps($colonnes, $analyses);
$this->testerNumNomClePrimaire($colonnes);
// Si la structure est bonne nous lançons les autres tests
Debug::printr($resultats);
if ($this->verifierResultats($resultats)) {
$this->testerTailleDesChamps($colonnes, $analyses);
$this->testerNumNomSuperieurAZero();
$this->testerNumNomRetenuSuperieurAZero();
$this->testerNumTaxSupEgalZeroUnique();
$this->testerTaxSupPourTaxon();
$this->testerExitenceTaxonSuperieur();
$this->testerClassificationRang();
$this->testerClassification();
$this->testerRang();
$this->testerNomCompletSupraGenerique();
$this->testerNomCompletGenre();
$this->testerNomCompletInfraGenre();
$this->testerNomCompletEspece();
$this->testerNomCompletInfraSpecifique();
$this->testerNomSupraGeneriqueEspaces();
$this->testerNomSupraGeneriqueSyntaxe();
$this->testerNomSupraGeneriqueRang();
$this->testerGenreEspaces();
$this->testerGenreSyntaxe();
$this->testerGenreRang();
$this->testerEpitheteInfraGeneriqueEspaces();
$this->testerEpitheteInfraGeneriqueSyntaxe();
$this->testerEpitheteInfraGeneriqueRang();
$this->testerEpitheteSpEspaces();
$this->testerEpitheteSpSyntaxe();
$this->testerEpitheteSpRang();
$this->testerTypeEpitheteEspaces();
$this->testerTypeEpitheteSyntaxe();
$this->testerTypeEpitheteHybridite();
$this->testerEpitheteInfraSpEspaces();
$this->testerEpitheteInfraSpSyntaxe();
$this->testerEpitheteInfraSpRang();
$this->testerGroupeCultivarSyntaxe();
$this->testerGroupeCultivarRang();
$this->testerCultivarSyntaxe();
$this->testerCultivarRang();
$this->testerNomCommercialSyntaxe();
$this->testerNomCommercialPresenceCultivar();
$this->testerAuteurSyntaxe();
$this->testerAnneeSyntaxe();
$this->testerBiblioOrigineSyntaxe();
$this->testerHomonymieSyntaxe();
$this->testerHomonymieExistence();
$this->testerBasionymeSyntaxe();
$this->testerBasionymeExistence();
$this->testerSynonymeProparteSyntaxe();
$this->testerSynonymeProparteExistence();
$this->testerSynonymeDouteuxSyntaxe();
$this->testerSynonymeMalAppliqueSyntaxe();
$this->testerSynonymeOrthographiqueSyntaxe();
$this->testerSynonymeOrthographiqueExistence();
$this->testerHybrideParent01Syntaxe();
$this->testerHybrideParent01Existence();
$this->testerHybrideParent02Syntaxe();
$this->testerHybrideParent02Existence();
$this->testerPresenceSyntaxe();
$this->testerStatutOrigineSyntaxe();
$this->testerStatutIntroductionSyntaxe();
$this->testerStatutCultureSyntaxe();
}
$this->testerNumNomSuperieurAZero($noms);
$this->testerNumNomRetenuSuperieurAZero($noms);
$this->testerNumTaxSupEgalZeroUnique($noms);
$this->testerTaxSupPourTaxon($noms);
$this->testerExitenceTaxonSuperieur($noms);
$this->testerClassificationRang($noms);
$this->testerClassification($noms);
$this->testerRang($noms);
$this->testerNomCompletSupraGenerique($noms);
$this->testerNomCompletGenre($noms);
$this->testerNomCompletInfraGenre($noms);
$this->testerNomCompletEspece($noms);
$this->testerNomCompletInfraSpecifique($noms);
 
$this->testerNomSupraGeneriqueEspaces($noms);
$this->testerNomSupraGeneriqueSyntaxe($noms);
$this->testerNomSupraGeneriqueRang($noms);
$this->testerGenreEspaces($noms);
$this->testerGenreSyntaxe($noms);
$this->testerGenreRang($noms);
$this->testerEpitheteInfraGeneriqueEspaces($noms);
$this->testerEpitheteInfraGeneriqueSyntaxe($noms);
$this->testerEpitheteInfraGeneriqueRang($noms);
$this->testerEpitheteSpEspaces($noms);
$this->testerEpitheteSpSyntaxe($noms);
$this->testerEpitheteSpRang($noms);
$this->testerTypeEpitheteEspaces($noms);
$this->testerTypeEpitheteSyntaxe($noms);
$this->testerTypeEpitheteHybridite($noms);
$this->testerEpitheteInfraSpEspaces($noms);
$this->testerEpitheteInfraSpSyntaxe($noms);
$this->testerEpitheteInfraSpRang($noms);
$this->testerGroupeCultivarSyntaxe($noms);
$this->testerGroupeCultivarRang($noms);
$this->testerCultivarSyntaxe($noms);
$this->testerCultivarRang($noms);
$this->testerNomCommercialSyntaxe($noms);
$this->testerNomCommercialPresenceCultivar($noms);
$this->testerAuteurSyntaxe($noms);
$this->testerAnneeSyntaxe($noms);
$this->testerBiblioOrigineSyntaxe($noms);
$this->testerHomonymieSyntaxe($noms);
$this->testerHomonymieExistence($noms, $noms_homonymie);
$this->testerBasionymeSyntaxe($noms);
$this->testerBasionymeExistence($noms);
$this->testerSynonymeProparteSyntaxe($noms);
$this->testerSynonymeProparteExistence($noms);
$this->testerSynonymeDouteuxSyntaxe($noms);
$this->testerSynonymeMalAppliqueSyntaxe($noms);
$this->testerSynonymeOrthographiqueSyntaxe($noms);
$this->testerSynonymeOrthographiqueExistence($noms);
$this->testerHybrideParent01Syntaxe($noms);
$this->testerHybrideParent01Existence($noms);
$this->testerHybrideParent02Syntaxe($noms);
$this->testerHybrideParent02Existence($noms);
$this->testerPresenceSyntaxe($noms);
$this->testerStatutOrigineSyntaxe($noms);
$this->testerStatutIntroductionSyntaxe($noms);
$this->testerStatutCultureSyntaxe($noms);
}
private function verifierResultats($resultats) {
$ok = true;
foreach ($resultats as $resultat) {
if ($resultat == '0') {
$ok = false;
break;
}
}
return $ok;
}
//+--------------------------------------------------------------------------------------------------------------+//
// Enregistrement des résultats
private function traiterResultatTest($info) {
Debug::printr($info['nom']);
if (isset($info['message'])) {
if (is_array($info['message'])) {
$info['message'] = $this->getVue('tests/squelettes/message_table', $info);
197,13 → 181,12
}
}
$this->resultatDao->ajouter($this->traitement['id_traitement'], $info);
$info = null;
}
//+--------------------------------------------------------------------------------------------------------------+//
// TESTS
private function testerStatutCultureSyntaxe() {
private function testerStatutCultureSyntaxe($noms) {
$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".
214,7 → 197,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['statut_culture'] != '') {
if (!$this->verifierStatutCulture($nom['statut_culture'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['statut_culture']);
229,12 → 212,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerStatutIntroductionSyntaxe() {
private function testerStatutIntroductionSyntaxe($noms) {
$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".
245,7 → 227,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['statut_introduction'] != '') {
if (!$this->verifierStatutIntroduction($nom['statut_introduction'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['statut_introduction']);
260,12 → 242,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerStatutOrigineSyntaxe() {
private function testerStatutOrigineSyntaxe($noms) {
$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".
276,7 → 257,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['statut_origine'] != '') {
if (!$this->verifierStatutOrigine($nom['statut_origine'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['statut_origine']);
291,12 → 272,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerPresenceSyntaxe() {
private function testerPresenceSyntaxe($noms) {
$info = array('nom' => 'presence -> syntaxe',
'description' => "Le champ presence contient soit :\n".
" - le symbole tiret «-» une autre information non référencée...\n".
307,7 → 287,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['presence'] != '') {
if (!$this->verifierPresence($nom['presence'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['presence']);
322,12 → 302,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerHybrideParent02Existence() {
private function testerHybrideParent02Existence($noms) {
$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.",
335,9 → 314,9
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['hybride_parent_02'] != '') {
if (!isset($this->noms[$nom['hybride_parent_02']]) && $nom['hybride_parent_02'] != '0') {
if (!isset($noms[$nom['hybride_parent_02']]) && $nom['hybride_parent_02'] != '0') {
$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']));
}
}
350,12 → 329,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerHybrideParent02Syntaxe() {
private function testerHybrideParent02Syntaxe($noms) {
$info = array('nom' => 'hybride_parent_02 -> syntaxe',
'description' => "Le champ hybride_parent_02 contient soit :\n".
" - une valeur vide.\n".
364,7 → 342,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['hybride_parent_02'] != '') {
if (!$this->verifierNombre($nom['hybride_parent_02'])) {
$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']));
379,13 → 357,12
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerHybrideParent01Existence() {
private function testerHybrideParent01Existence($noms) {
$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.",
393,9 → 370,9
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['hybride_parent_01'] != '' && $nom['hybride_parent_01'] != '0') {
if (!isset($this->noms[$nom['hybride_parent_01']])) {
if (!isset($noms[$nom['hybride_parent_01']])) {
$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']));
}
}
408,12 → 385,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerHybrideParent01Syntaxe() {
private function testerHybrideParent01Syntaxe($noms) {
$info = array('nom' => 'hybride_parent_01 -> syntaxe',
'description' => "Le champ hybride_parent_01 contient soit :\n".
" - une valeur vide.\n".
422,7 → 398,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['hybride_parent_01'] != '') {
if (!$this->verifierNombre($nom['hybride_parent_01'])) {
$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']));
437,12 → 413,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerSynonymeOrthographiqueExistence() {
private function testerSynonymeOrthographiqueExistence($noms) {
$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.",
450,9 → 425,9
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['synonyme_orthographique'] != '') {
if (!isset($this->noms[$nom['synonyme_orthographique']])) {
if (!isset($noms[$nom['synonyme_orthographique']])) {
$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique']);
}
}
465,12 → 440,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerSynonymeOrthographiqueSyntaxe() {
private function testerSynonymeOrthographiqueSyntaxe($noms) {
$info = array('nom' => 'synonyme_orthographique -> syntaxe',
'description' => "Le champ synonyme_orthographique contient soit :\n".
" - une valeur vide.\n".
479,7 → 453,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as $nom) {
foreach ($noms as $nom) {
if ($nom['synonyme_orthographique'] != '') {
if (!$this->verifierNombre($nom['synonyme_orthographique'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique']);
494,12 → 468,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerSynonymeMalAppliqueSyntaxe() {
private function testerSynonymeMalAppliqueSyntaxe($noms) {
$info = array('nom' => 'synonyme_mal_applique -> syntaxe',
'description' => "Le champ synonyme_mal_applique contient soit :\n".
" - une valeur vide.\n".
508,7 → 481,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['synonyme_mal_applique'] != '') {
if (!$this->verifierBooleen($nom['synonyme_mal_applique'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_mal_applique']);
523,12 → 496,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerSynonymeDouteuxSyntaxe() {
private function testerSynonymeDouteuxSyntaxe($noms) {
$info = array('nom' => 'synonyme_douteux -> syntaxe',
'description' => "Le champ synonyme_douteux contient soit :\n".
" - une valeur vide.\n".
537,7 → 509,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['synonyme_douteux'] != '') {
if (!$this->verifierBooleen($nom['synonyme_douteux'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux']);
552,12 → 524,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerSynonymeProparteExistence() {
private function testerSynonymeProparteExistence($noms) {
$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.",
565,12 → 536,12
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['synonyme_proparte'] != '') {
$num_nom_a_verifier = explode(',', $nom['synonyme_proparte']);
$num_nom_en_erreur = array();
foreach ($num_nom_a_verifier as $num_nom) {
if (!isset($this->noms[$num_nom])) {
if (!isset($noms[$num_nom])) {
$num_nom_en_erreur[] = $num_nom;
}
}
587,12 → 558,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerSynonymeProparteSyntaxe() {
private function testerSynonymeProparteSyntaxe($noms) {
$info = array('nom' => 'synonyme_proparte -> syntaxe',
'description' => "Le champ synonyme_proparte contient soit :\n".
" - une valeur vide.\n".
602,7 → 572,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['synonyme_proparte'] != '') {
if (!$this->verifierNombreSuite($nom['synonyme_proparte'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_proparte']);
617,12 → 587,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerBasionymeExistence() {
private function testerBasionymeExistence($noms) {
$info = array('nom' => 'basionyme -> existence',
'description' => "Si le champ basionyme contient un nombre alors il doit correspondre à une valeur du champ ".
"num_nom.",
630,9 → 599,9
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['basionyme'] != '') {
if (!isset($this->noms[$nom['basionyme']])) {
if (!isset($noms[$nom['basionyme']])) {
$noms_erreur[] = array($nom['num_nom'], $nom['basionyme']);
}
}
645,12 → 614,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerBasionymeSyntaxe() {
private function testerBasionymeSyntaxe($noms) {
$info = array('nom' => 'basionyme -> syntaxe',
'description' => "Le champ basionyme contient :\n".
" - un nombre ou une valeur vide.\n",
658,7 → 626,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['basionyme'] != '') {
if (!$this->verifierNombre($nom['basionyme'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['basionyme']);
673,22 → 641,19
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerHomonymieExistence() {
private function testerHomonymieExistence($noms, $noms_homonymie) {
$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);
$noms_homonymie = $this->classerNomsParNomComplet();
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['homonyme'] != '0' && $nom['homonyme'] != '') {
if ($noms_homonymie[$nom['nom_complet']] <= 1) {
$noms_erreur[] = array($nom['num_nom'], $nom['nom_complet']);
695,7 → 660,6
}
}
}
$noms_homonymie = null;
// Analyse des résultats
if (count($noms_erreur) > 0) {
704,12 → 668,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerHomonymieSyntaxe() {
private function testerHomonymieSyntaxe($noms) {
$info = array('nom' => 'homonyme -> syntaxe',
'description' => "Le champ homonyme contient :\n".
" - le chiffre 1 ou une valeur vide.\n",
717,7 → 680,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['homonyme'] != '') {
if (!$this->verifierBooleen($nom['homonyme'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['homonyme']);
732,12 → 695,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerBiblioOrigineSyntaxe() {
private function testerBiblioOrigineSyntaxe($noms) {
$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".
758,7 → 720,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['biblio_origine'] != '') {
if (!$this->verifierBiblioOrigine($nom['biblio_origine'])) {
$biblio_traite = $this->repererEspace($nom['biblio_origine']);
774,12 → 736,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerAnneeSyntaxe() {
private function testerAnneeSyntaxe($noms) {
$info = array('nom' => 'annee -> syntaxe',
'description' => "Le champ annee doit :\n".
" - contenir un nombre de 4 chiffre\n".
788,7 → 749,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['annee'] != '') {
if (!$this->verifierAnnee($nom['annee'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['annee']);
803,12 → 764,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerAuteurSyntaxe() {
private function testerAuteurSyntaxe($noms) {
$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".
824,7 → 784,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['auteur'] != '') {
if (!$this->verifierAuteur($nom['auteur'])) {
$intitule_traite = $this->repererEspace($nom['auteur']);
840,12 → 800,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerNomCommercialSyntaxe() {
private function testerNomCommercialSyntaxe($noms) {
$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) ".
854,7 → 813,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['nom_commercial'] != '') {
if (!$this->verifierNomCommercial($nom['nom_commercial'])) {
$epithete_traite = $this->repererEspace($nom['nom_commercial']);
870,12 → 829,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerNomCommercialPresenceCultivar() {
private function testerNomCommercialPresenceCultivar($noms) {
$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.",
883,8 → 841,8
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
if ((isset($nom['nom_commercial']) && $nom['nom_commercial'] != '') && ($nom['cultivar'] == '' && $nom['cultivar_groupe'] == '')) {
foreach ($noms as $nom) {
if ($nom['nom_commercial'] != '' && ($nom['cultivar'] == '' && $nom['cultivar_groupe'] == '')) {
$noms_erreur[] = array($nom['num_nom'], $nom['nom_complet']);
}
}
896,12 → 854,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerCultivarSyntaxe() {
private function testerCultivarSyntaxe($noms) {
$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 ".
917,7 → 874,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['cultivar'] != '') {
if (!$this->verifierEpitheteCultivar($nom['cultivar'])) {
$epithete_traite = $this->repererEspace($nom['cultivar']);
933,12 → 890,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerCultivarRang() {
private function testerCultivarRang($noms) {
$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);
945,7 → 901,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['cultivar'] != '') {
if ($nom['rang'] < $this->manuel['rang_genre']) {
$noms_erreur[] = array($nom['num_nom'], $nom['nom_complet'], $nom['rang']);
960,12 → 916,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerGroupeCultivarSyntaxe() {
private function testerGroupeCultivarSyntaxe($noms) {
$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 ".
976,7 → 931,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['cultivar_groupe'] != '') {
if (!$this->verifierEpitheteGroupeCultivar($nom['cultivar_groupe'])) {
$epithete_traite = $this->repererEspace($nom['cultivar_groupe']);
992,12 → 947,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerGroupeCultivarRang() {
private function testerGroupeCultivarRang($noms) {
$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);
1004,7 → 958,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['cultivar_groupe'] != '') {
if ($nom['rang'] < $this->manuel['rang_genre']) {
$noms_erreur[] = array($nom['num_nom'], $nom['nom_complet'], $nom['rang']);
1019,12 → 973,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraSpEspaces() {
private function testerEpitheteInfraSpEspaces($noms) {
$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.",
1032,7 → 985,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['epithete_infra_sp'] != '') {
if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_sp'])) {
$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
1048,12 → 1001,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraSpSyntaxe() {
private function testerEpitheteInfraSpSyntaxe($noms) {
$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".
1065,7 → 1017,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['epithete_infra_sp'] != '') {
$mots = explode(' ', $nom['epithete_infra_sp']);
foreach ($mots as $mot) {
1084,12 → 1036,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraSpRang() {
private function testerEpitheteInfraSpRang($noms) {
$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);
1096,7 → 1047,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['epithete_infra_sp'] != '') {
if ($nom['rang'] < $this->manuel['rang_sp']) {
$noms_erreur[] = array($nom['num_nom'], $nom['nom_complet'], $nom['rang']);
1111,12 → 1062,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerTypeEpitheteEspaces() {
private function testerTypeEpitheteEspaces($noms) {
$info = array('nom' => 'type_epithete -> espaces en trop',
'description' => "Le champ type_epithete ne doit pas contenir d'espace.",
'resultat' => false);
1123,7 → 1073,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['type_epithete'] != '') {
if (preg_match('/\s+/', $nom['type_epithete'])) {
$valeur_traitee = $this->repererEspace($nom['epithete_sp']);
1143,7 → 1093,7
$this->traiterResultatTest($info);
}
private function testerTypeEpitheteSyntaxe() {
private function testerTypeEpitheteSyntaxe($noms) {
$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.",
1151,7 → 1101,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['type_epithete'] != '') {
if (!$this->verifierTypeEpithete($nom['type_epithete'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['type_epithete']);
1170,7 → 1120,7
$this->traiterResultatTest($info);
}
private function testerTypeEpitheteHybridite() {
private function testerTypeEpitheteHybridite($noms) {
$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".
1179,7 → 1129,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['type_epithete'] != '') {
if (preg_match('/^(?:n-|notho-)/', $nom['type_epithete'])) {
$noms_erreur[] = array($nom['num_nom'], $nom['type_epithete']);
1209,7 → 1159,6
$info['resultat'] = true;
}
$this->traiterResultatTest($info);
return ($info['resultat'] ? '1' : '0');
}
private function testerNomDesChamps($colonnes) {
1237,7 → 1186,6
}
$this->traiterResultatTest($info);
return ($info['resultat'] ? '1' : '0');
}
private function testerTypeDesChamps($colonnes) {
1277,7 → 1225,6
}
$this->traiterResultatTest($info);
return ($info['resultat'] ? '1' : '0');
}
private function testerTailleDesChamps($colonnes, $analyses) {
1334,10 → 1281,9
}
$this->traiterResultatTest($info);
return ($info['resultat'] ? '1' : '0');
}
private function testerNumNomSuperieurAZero() {
private function testerNumNomSuperieurAZero($noms) {
$info = array('nom' => 'num_nom -> supérieur à 0',
'description' => "Le champ num_nom doit contenir des nombres entiers supérieurs à 0.",
'resultat' => false);
1344,7 → 1290,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['num_nom'] <= 0) {
$noms_erreur[] = $nom['num_nom'];
}
1360,7 → 1306,7
$this->traiterResultatTest($info);
}
private function testerNumNomRetenuSuperieurAZero() {
private function testerNumNomRetenuSuperieurAZero($noms) {
$info = array('nom' => 'num_nom_retenu -> supérieur à 0',
'description' => "Le champ num_nom_retenu doit contenir des nombres entiers supérieurs à 0 ou être vide.",
'resultat' => false);
1367,7 → 1313,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['num_nom_retenu'] != '' && $nom['num_nom_retenu'] <= 0) {
$noms_erreur[] = $nom['num_nom'];
}
1383,7 → 1329,7
$this->traiterResultatTest($info);
}
private function testerNumTaxSupEgalZeroUnique() {
private function testerNumTaxSupEgalZeroUnique($noms) {
$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);
1390,7 → 1336,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if (preg_match('/^0$/', $nom['num_tax_sup'])) {
$noms_erreur[] = $nom['num_nom'];
}
1406,7 → 1352,7
$this->traiterResultatTest($info);
}
private function testerTaxSupPourTaxon() {
private function testerTaxSupPourTaxon($noms) {
$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.\n".
"Si num_nom_retenu est différent de num_nom (= nom synonyme) alors num_tax_sup doit être vide.",
1414,7 → 1360,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['num_nom_retenu'] != $nom['num_nom'] && $nom['num_tax_sup'] != '') {
$noms_erreur[] = $nom['num_nom'];
}
1430,7 → 1376,7
$this->traiterResultatTest($info);
}
private function testerExitenceTaxonSuperieur() {
private function testerExitenceTaxonSuperieur($noms) {
$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);
1437,9 → 1383,9
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['num_nom_retenu'] == $nom['num_nom']) {
if ($nom['num_tax_sup'] != 0 && !isset($this->noms[$nom['num_tax_sup']])) {
if ($nom['num_tax_sup'] != 0 && !isset($noms[$nom['num_tax_sup']])) {
$noms_erreur[] = $nom['num_nom'];
}
}
1455,7 → 1401,7
$this->traiterResultatTest($info);
}
private function testerClassificationRang() {
private function testerClassificationRang($noms) {
$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);
1462,10 → 1408,10
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['num_nom_retenu'] == $nom['num_nom']) {
if (isset($this->noms[$nom['num_tax_sup']])) {
$nom_sup = $this->noms[$nom['num_tax_sup']];
if (isset($noms[$nom['num_tax_sup']])) {
$nom_sup = $noms[$nom['num_tax_sup']];
if ($nom_sup['rang'] > $nom['rang']) {
$noms_erreur[] = $nom['num_nom'];
}
1483,7 → 1429,7
$this->traiterResultatTest($info);
}
private function testerClassification() {
private function testerClassification($noms) {
$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);
1490,9 → 1436,9
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['num_nom_retenu'] == $nom['num_nom']) {
$classif_ok = $this->remonterClassif($nom);
$classif_ok = $this->remonterClassif($noms, $nom);
if ($classif_ok === false) {
$noms_erreur[] = $nom['num_nom'];
}
1509,21 → 1455,17
$this->traiterResultatTest($info);
}
private function remonterClassif($nom) {
if (is_int($nom['num_tax_sup'])) {
if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] == '0') {
return true;
} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] != '0') {
return false;
} else {
return $this->remonterClassif($this->noms[$nom['num_tax_sup']]);
}
private function remonterClassif(&$noms, $nom) {
if (!isset($noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] == '0') {
return true;
} else if (!isset($noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] != '0') {
return false;
} else {
return false;
return $this->remonterClassif($noms, $noms[$nom['num_tax_sup']]);
}
}
private function testerRang() {
private function testerRang($noms) {
$info = array('nom' => 'rang',
'description' => "Le rang doit correspondre à un valeur numérique définit dans le manuel.",
'resultat' => false);
1532,7 → 1474,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if (!isset($rangs[$nom['rang']])) {
$noms_erreur[] = $nom['num_nom'];
}
1548,7 → 1490,7
$this->traiterResultatTest($info);
}
private function testerNomCompletSupraGenerique() {
private function testerNomCompletSupraGenerique($noms) {
$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.",
1556,7 → 1498,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['rang'] < $this->manuel['rang_genre']) {
$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
$nom_complet_ideal = $this->formaterStyleNomGenre($nom['nom_supra_generique']);
1579,7 → 1521,7
$this->traiterResultatTest($info);
}
private function testerNomCompletGenre() {
private function testerNomCompletGenre($noms) {
$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.",
1587,7 → 1529,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['rang'] == $this->manuel['rang_genre']) {
$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
$nom_complet_ideal = $this->formaterStyleNomGenre($nom['genre']);
1610,7 → 1552,7
$this->traiterResultatTest($info);
}
private function testerNomCompletInfraGenre() {
private function testerNomCompletInfraGenre($noms) {
$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".
1620,7 → 1562,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['rang'] > $this->manuel['rang_genre'] && $nom['rang'] < $this->manuel['rang_sp']) {
$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
$nom_complet_ideal = '';
1648,12 → 1590,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerNomCompletEspece() {
private function testerNomCompletEspece($noms) {
$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".
1662,7 → 1603,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['rang'] == $this->manuel['rang_sp']) {
$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
$nom_complet_ideal = $this->formaterStyleNomGenre($nom['genre']);
1682,12 → 1623,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerNomCompletInfraSpecifique() {
private function testerNomCompletInfraSpecifique($noms) {
$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".
1696,7 → 1636,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['rang'] > $this->manuel['rang_sp']) {
$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
$nom_complet_ideal = $this->formaterStyleNomGenre($nom['genre']);
1718,12 → 1658,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerNomSupraGeneriqueEspaces() {
private function testerNomSupraGeneriqueEspaces($noms) {
$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);
1730,7 → 1669,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['nom_supra_generique'] != '') {
if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s+$)/', $nom['nom_supra_generique'])) {
$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
1746,12 → 1685,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerNomSupraGeneriqueSyntaxe() {
private function testerNomSupraGeneriqueSyntaxe($noms) {
$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.",
1759,7 → 1697,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['nom_supra_generique'] != '') {
if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+$/', $nom['nom_supra_generique'])) {
$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
1775,12 → 1713,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerNomSupraGeneriqueRang() {
private function testerNomSupraGeneriqueRang($noms) {
$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);
1787,7 → 1724,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['nom_supra_generique'] != '') {
if ($nom['rang'] >= $this->manuel['rang_genre']) {
$noms_erreur[] = array($nom['num_nom'], $nom['nom_complet'], $nom['rang']);
1802,12 → 1739,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerGenreEspaces() {
private function testerGenreEspaces($noms) {
$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.",
1815,7 → 1751,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['genre'] != '') {
if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['genre'])) {
$nom_traite = $this->repererEspace($nom['genre']);
1831,12 → 1767,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerGenreSyntaxe() {
private function testerGenreSyntaxe($noms) {
$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".
1848,7 → 1783,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['genre'] != '') {
$mots = explode(' ', $nom['genre']);
foreach ($mots as $mot) {
1867,12 → 1802,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerGenreRang() {
private function testerGenreRang($noms) {
$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);
1879,7 → 1813,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['genre'] != '') {
if ($nom['rang'] < $this->manuel['rang_genre']) {
$noms_erreur[] = array($nom['num_nom'], $nom['nom_complet'], $nom['rang']);
1894,12 → 1828,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraGeneriqueSyntaxe() {
private function testerEpitheteInfraGeneriqueSyntaxe($noms) {
$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.",
1907,7 → 1840,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['epithete_infra_generique'] != '') {
if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+/', $nom['epithete_infra_generique'])) {
$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
1923,12 → 1856,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraGeneriqueRang() {
private function testerEpitheteInfraGeneriqueRang($noms) {
$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']}.",
1936,7 → 1868,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['epithete_infra_generique'] != '') {
if ($nom['rang'] <= $this->manuel['rang_genre'] || $nom['rang'] >= $this->manuel['rang_sp']) {
$noms_erreur[] = array($nom['num_nom'], $nom['nom_complet'], $nom['rang']);
1951,12 → 1883,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerEpitheteInfraGeneriqueEspaces() {
private function testerEpitheteInfraGeneriqueEspaces($noms) {
$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);
1963,7 → 1894,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['epithete_infra_generique'] != '') {
if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_generique'])) {
$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
1979,12 → 1910,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerEpitheteSpEspaces() {
private function testerEpitheteSpEspaces($noms) {
$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.",
1992,7 → 1922,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['epithete_sp'] != '') {
if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_sp'])) {
$epithete_traite = $this->repererEspace($nom['epithete_sp']);
2008,12 → 1938,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerEpitheteSpSyntaxe() {
private function testerEpitheteSpSyntaxe($noms) {
$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".
2026,7 → 1955,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['epithete_sp'] != '') {
$mots = explode(' ', $nom['epithete_sp']);
foreach ($mots as $mot) {
2045,12 → 1974,11
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
private function testerEpitheteSpRang() {
private function testerEpitheteSpRang($noms) {
$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);
2057,7 → 1985,7
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
if ($nom['epithete_sp'] != '') {
if ($nom['rang'] < $this->manuel['rang_sp']) {
$noms_erreur[] = array($nom['num_nom'], $nom['nom_complet'], $nom['rang']);
2072,7 → 2000,6
} else {
$info['resultat'] = true;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
2080,31 → 2007,31
//+--------------------------------------------------------------------------------------------------------------+//
// MÉTHODES COMMUNES aux TESTS
private function verifierPresence(&$valeur) {
private function verifierPresence($valeur) {
$codes = $this->manuel['codes_presence'];
$ok = $this->verifierStatuts($valeur, $codes);
return $ok;
}
private function verifierStatutOrigine(&$valeur) {
private function verifierStatutOrigine($valeur) {
$codes = $this->manuel['codes_statuts_origine'];
$ok = $this->verifierStatuts($valeur, $codes);
return $ok;
}
private function verifierStatutIntroduction(&$valeur) {
private function verifierStatutIntroduction($valeur) {
$codes = $this->manuel['codes_statuts_introduction'];
$ok = $this->verifierStatuts($valeur, $codes);
return $ok;
}
private function verifierStatutCulture(&$valeur) {
private function verifierStatutCulture($valeur) {
$codes = $this->manuel['codes_statuts_culture'];
$ok = $this->verifierStatuts($valeur, $codes);
return $ok;
}
private function verifierStatuts(&$valeur, &$codes) {
private function verifierStatuts($valeur, $codes) {
$ok = true;
if (!preg_match("/^(?:|-|[$codes](?:-[A-Z])?)$/", $valeur)) {
$ok = false;
2112,7 → 2039,7
return $ok;
}
private function verifierBooleen(&$valeur) {
private function verifierBooleen($valeur) {
$ok = true;
if (!preg_match('/^1$/', $valeur)) {
$ok = false;
2120,7 → 2047,7
return $ok;
}
private function verifierNombre(&$valeur) {
private function verifierNombre($valeur) {
$ok = true;
if (!preg_match('/^[0-9]+$/', $valeur)) {
$ok = false;
2128,7 → 2055,7
return $ok;
}
private function verifierNombreSuite(&$valeur) {
private function verifierNombreSuite($valeur) {
$ok = true;
if (!preg_match('/^(?:[0-9]+,)*[0-9]+$/', $valeur)) {
$ok = false;
2136,7 → 2063,7
return $ok;
}
private function verifierTypeEpithete(&$type) {
private function verifierTypeEpithete($type) {
$ok = false;
$rejetes = $this->manuel['type_epithete_rejetes'];
if (preg_replace("/^(?:$rejetes)$/", '', $type) == '') {
2147,7 → 2074,7
return $ok;
}
private function verifierBiblioOrigine(&$intitule) {
private function verifierBiblioOrigine($intitule) {
$ok = true;
if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
$ok = false;// Contient des espaces en trop
2159,7 → 2086,7
return $ok;
}
private function verifierAnnee(&$annee) {
private function verifierAnnee($annee) {
$ok = true;
if (!preg_match('/^[0-9]{4}$/', $annee)) {
$ok = false;
2169,7 → 2096,7
return $ok;
}
private function verifierAuteur(&$intitule) {
private function verifierAuteur($intitule) {
$ok = true;
$acceptes = $this->manuel['auteur_acceptes'];
if (!preg_match("/^(?:$acceptes)$/", $intitule)) {
2192,7 → 2119,7
return $ok;
}
private function verifierNomCommercial(&$epithete) {
private function verifierNomCommercial($epithete) {
$ok = false;
if (preg_match("/^[[:upper:][:punct:][:digit:][:space:]]+$/", $epithete)) {
$ok = true;
2200,7 → 2127,7
return $ok;
}
private function verifierEpitheteCultivar(&$epithete) {
private function verifierEpitheteCultivar($epithete) {
$ok = true;
$acceptes = $this->manuel['cultivar_acceptes'];
if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
2235,7 → 2162,7
return $ok;
}
private function verifierEpitheteGroupeCultivar(&$epithete) {
private function verifierEpitheteGroupeCultivar($epithete) {
$ok = true;
$acceptes = $this->manuel['cultivar_gp_acceptes'];
if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
2273,7 → 2200,7
return $ok;
}
private function verifierEpitheteSp(&$epithete) {
private function verifierEpitheteSp($epithete) {
$ok = false;
if (preg_match('/^[a-zëï][-a-zëï]+$/', $epithete)) {
$ok = true;
2283,7 → 2210,7
return $ok;
}
private function verifierEpitheteGenre(&$epithete) {
private function verifierEpitheteGenre($epithete) {
$ok = false;
if (preg_match('/^[A-ZËÏ](?:[-a-zëï]+|[a-zëï]+-[A-ZËÏ][a-zëï]+)$/', $epithete)) {
$ok = true;
2291,7 → 2218,7
return $ok;
}
private function formaterStyleNomGenre(&$genre) {
private function formaterStyleNomGenre($genre) {
$genre_fmt = '';
if (preg_match('/^\s*([x+])\s+(.+)$/i', $genre, $match)) {
$genre_fmt = strtolower($match[1]).' '.ucfirst(strtolower($match[2]));
2306,7 → 2233,7
return $nom_complet;
}
private function construireSuffixeNomPltCultivee(&$nom) {
private function construireSuffixeNomPltCultivee($nom) {
$suffixe = array();
$suffixe[] = $this->construireNomCultivarGroupe($nom);
$suffixe[] = $this->construireNomCommercial($nom);
2315,7 → 2242,7
return implode(' ', $suffixe);
}
private function construireNomCultivarGroupe(&$nom) {
private function construireNomCultivarGroupe($nom) {
$nom_groupe_cultivar = '';
if ($nom['cultivar_groupe'] != '') {
if (preg_match('/ gx$/', $nom['cultivar_groupe'])) {
2327,7 → 2254,7
return $nom_groupe_cultivar;
}
private function construireNomCommercial(&$nom) {
private function construireNomCommercial($nom) {
$nom_commercial = '';
if ($nom['nom_commercial'] != '') {
$nom_commercial = strtoupper($nom['nom_commercial']);
2335,7 → 2262,7
return $nom_commercial;
}
private function construireNomCultivar(&$nom) {
private function construireNomCultivar($nom) {
$nom_cultivar = '';
if ($nom['cultivar'] != '') {
$nom_cultivar = "'".$nom['cultivar']."'";
2343,9 → 2270,17
return $nom_cultivar;
}
private function classerNomsParNomComplet() {
private function classerNomsParNumNom($noms) {
$noms_classes = array();
foreach ($this->noms as &$nom) {
foreach ($noms as $nom) {
$noms_classes[$nom['num_nom']] = $nom;
}
return $noms_classes;
}
private function classerNomsParNomComplet($noms) {
$noms_classes = array();
foreach ($noms as $nom) {
if (!isset($noms_classes[$nom['nom_complet']])) {
$noms_classes[$nom['nom_complet']] = 1;
} else {