36,6 → 36,7 |
|
public function executer() { |
$this->manuel = parse_ini_file(Config::get('chemin_appli').DS.'..'.DS.'configurations'.DS.'referentiel_v4.1.ini'); |
$this->definirConstantes(); |
$this->tests = parse_ini_file($this->getModuleChemin().DS.'configurations'.DS.'tests.ini', true); |
|
$this->resultatDao = new ResultatDao(); |
81,6 → 82,15 |
} |
} |
|
/** |
* Cette méthode définie des constantes qui peuvent ensuite être utilisée dans les fichier ini. |
* Surtout utile pour le fichier tests.ini |
*/ |
private function definirConstantes() { |
define('RANG_GENRE', $this->manuel['rang_genre']); |
define('RANG_SP', $this->manuel['rang_sp']); |
} |
|
public function recupererDonnees() { |
// Récupération des données à tester |
$this->colonnes = $this->tableStructureDao->getColonnes($this->projet); |
114,9 → 124,10 |
if (isset($erreurs['special'])) { |
$info = $erreurs; |
} else { |
if (count($erreurs) > 0) { |
if (count($erreurs) > 0) { |
$info['message']['entete'] = explode(',', $info['entete']); |
$info['message']['lignes'] = $erreurs; |
unset($erreurs); |
} else { |
$info['resultat'] = true; |
} |
397,8 → 408,6 |
* Test #07 |
*/ |
private function testerNumNomRetenuSuperieurAZero() { |
$info = $this->getInfosTest(7); |
|
// Réalisation du test |
$noms_erreur = array(); |
foreach ($this->noms as &$nom) { |
406,16 → 415,7 |
$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu']); |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'num_nom_retenu'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |
422,8 → 422,6 |
* Test #08 |
*/ |
private function testerNumTaxSupEgalZeroUnique() { |
$info = $this->getInfosTest(8); |
|
// Réalisation du test |
$noms_erreur = array(); |
foreach ($this->noms as &$nom) { |
431,16 → 429,11 |
$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup']); |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 1) { |
$info['message']['entete'] = array('num_nom', 'num_tax_sup'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
// Ce test est spécial car le nombre de noms en erreurs doit être supérieur à 1 et non à 0 pour être KO. |
if (count($noms_erreur) == 1) { |
$noms_erreur[] = array(); |
} |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |
447,8 → 440,6 |
* Test #09 |
*/ |
private function testerTaxSupPourTaxon() { |
$info = $this->getInfosTest(9); |
|
// Réalisation du test |
$noms_erreur = array(); |
foreach ($this->noms as &$nom) { |
456,16 → 447,7 |
$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup']); |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'num_tax_sup'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |
472,8 → 454,6 |
* Test #10 |
*/ |
private function testerExitenceTaxonSuperieur() { |
$info = $this->getInfosTest(10); |
|
// Réalisation du test |
$noms_erreur = array(); |
foreach ($this->noms as &$nom) { |
483,16 → 463,7 |
} |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'num_tax_sup'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |
499,8 → 470,6 |
* Test #11 |
*/ |
private function testerClassificationRang() { |
$info = $this->getInfosTest(11); |
|
// Réalisation du test |
$noms_erreur = array(); |
foreach ($this->noms as &$nom) { |
516,16 → 485,7 |
} |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'rang', 'Taxon supérieur num_nom', 'Taxon supérieur rang'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |
532,8 → 492,6 |
* Test #12 |
*/ |
private function testerClassification() { |
$info = $this->getInfosTest(12); |
|
// Réalisation du test |
$noms_erreur = array(); |
$this->noms_ok = array(); |
555,16 → 513,7 |
} |
} |
unset($this->noms_ok); |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'Message du problème'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
private function remonterClassif(&$nom) { |
596,8 → 545,6 |
* Test #13 |
*/ |
private function testerRang() { |
$info = $this->getInfosTest(13); |
|
$rangs = array_flip(explode(',', $this->manuel['rangs'])); |
|
// Réalisation du test |
607,16 → 554,7 |
$noms_erreur[] = array($nom['num_nom'], $nom['rang']); |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'Rang'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |
623,9 → 561,6 |
* Test #14 |
*/ |
private function testerNomCompletSupraGenerique() { |
$info = $this->getInfosTest(14); |
$info['description'] = sprintf($info['description'], $this->manuel['rang_genre']); |
|
// Réalisation du test |
$noms_erreur = array(); |
foreach ($this->noms as &$nom) { |
639,16 → 574,7 |
} |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'nom_sci', 'nom_sci corrigé'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |
655,9 → 581,6 |
* Test #15 |
*/ |
private function testerNomCompletGenre() { |
$info = $this->getInfosTest(15); |
$info['description'] = sprintf($info['description'], $this->manuel['rang_genre']); |
|
// Réalisation du test |
$noms_erreur = array(); |
foreach ($this->noms as &$nom) { |
671,16 → 594,7 |
} |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'nom_sci', 'nom_sci corrigé'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |
687,9 → 601,6 |
* Test #16 |
*/ |
private function testerNomCompletInfraGenre() { |
$info = $this->getInfosTest(16); |
$info['description'] = sprintf($info['description'], $this->manuel['rang_genre'], $this->manuel['rang_sp']); |
|
// Réalisation du test |
$noms_erreur = array(); |
foreach ($this->noms as &$nom) { |
712,17 → 623,7 |
} |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'nom_sci', 'nom_sci corrigé'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
$noms_erreur = null; |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |
729,9 → 630,6 |
* Test #17 |
*/ |
private function testerNomCompletEspece() { |
$info = $this->getInfosTest(17); |
$info['description'] = sprintf($info['description'], $this->manuel['rang_sp']); |
|
// Réalisation du test |
$noms_erreur = array(); |
foreach ($this->noms as &$nom) { |
746,17 → 644,7 |
} |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'nom_sci', 'nom_sci corrigé'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
$noms_erreur = null; |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |
763,9 → 651,6 |
* Test #18 |
*/ |
private function testerNomCompletInfraSpecifique() { |
$info = $this->getInfosTest(18); |
$info['description'] = sprintf($info['description'], $this->manuel['rang_sp']); |
|
// Réalisation du test |
$noms_erreur = array(); |
foreach ($this->noms as &$nom) { |
782,17 → 667,7 |
} |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'nom_sci', 'nom_sci corrigé'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
$noms_erreur = null; |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |
799,8 → 674,6 |
* Test #19 |
*/ |
private function testerNomSupraGeneriqueEspaces() { |
$info = $this->getInfosTest(19); |
|
// Réalisation du test |
$noms_erreur = array(); |
foreach ($this->noms as &$nom) { |
811,17 → 684,7 |
} |
} |
} |
|
// Analyse des résultats |
if (count($noms_erreur) > 0) { |
$info['message']['entete'] = array('num_nom', 'nom_supra_generique erroné'); |
$info['message']['lignes'] = $noms_erreur; |
} else { |
$info['resultat'] = true; |
} |
$noms_erreur = null; |
|
$this->traiterResultatTest($info); |
return $noms_erreur; |
} |
|
/** |