Subversion Repositories Applications.referentiel

Compare Revisions

Ignore whitespace Rev 176 → Rev 175

/trunk/scripts/modules/tests/Tests.php
36,7 → 36,6
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();
82,15 → 81,6
}
}
/**
* 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);
124,10 → 114,9
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;
}
408,6 → 397,8
* Test #07
*/
private function testerNumNomRetenuSuperieurAZero() {
$info = $this->getInfosTest(7);
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
415,7 → 406,16
$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu']);
}
}
return $noms_erreur;
// 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);
}
/**
422,6 → 422,8
* Test #08
*/
private function testerNumTaxSupEgalZeroUnique() {
$info = $this->getInfosTest(8);
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
429,11 → 431,16
$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup']);
}
}
// 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();
// 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;
}
return $noms_erreur;
$this->traiterResultatTest($info);
}
/**
440,6 → 447,8
* Test #09
*/
private function testerTaxSupPourTaxon() {
$info = $this->getInfosTest(9);
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
447,7 → 456,16
$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup']);
}
}
return $noms_erreur;
// 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);
}
/**
454,6 → 472,8
* Test #10
*/
private function testerExitenceTaxonSuperieur() {
$info = $this->getInfosTest(10);
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
463,7 → 483,16
}
}
}
return $noms_erreur;
// 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);
}
/**
470,6 → 499,8
* Test #11
*/
private function testerClassificationRang() {
$info = $this->getInfosTest(11);
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
485,7 → 516,16
}
}
}
return $noms_erreur;
// 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);
}
/**
492,6 → 532,8
* Test #12
*/
private function testerClassification() {
$info = $this->getInfosTest(12);
// Réalisation du test
$noms_erreur = array();
$this->noms_ok = array();
513,7 → 555,16
}
}
unset($this->noms_ok);
return $noms_erreur;
// 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);
}
private function remonterClassif(&$nom) {
545,6 → 596,8
* Test #13
*/
private function testerRang() {
$info = $this->getInfosTest(13);
$rangs = array_flip(explode(',', $this->manuel['rangs']));
// Réalisation du test
554,7 → 607,16
$noms_erreur[] = array($nom['num_nom'], $nom['rang']);
}
}
return $noms_erreur;
// 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);
}
/**
561,6 → 623,9
* 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) {
574,7 → 639,16
}
}
}
return $noms_erreur;
// 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);
}
/**
581,6 → 655,9
* 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) {
594,7 → 671,16
}
}
}
return $noms_erreur;
// 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);
}
/**
601,6 → 687,9
* 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) {
623,7 → 712,17
}
}
}
return $noms_erreur;
// 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);
}
/**
630,6 → 729,9
* 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) {
644,7 → 746,17
}
}
}
return $noms_erreur;
// 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);
}
/**
651,6 → 763,9
* 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) {
667,7 → 782,17
}
}
}
return $noms_erreur;
// 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);
}
/**
674,6 → 799,8
* Test #19
*/
private function testerNomSupraGeneriqueEspaces() {
$info = $this->getInfosTest(19);
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
684,7 → 811,17
}
}
}
return $noms_erreur;
// 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);
}
/**