Subversion Repositories Applications.referentiel

Compare Revisions

Regard whitespace Rev 175 → Rev 176

/trunk/scripts/modules/tests/Tests.php
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);
117,6 → 127,7
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,24 → 415,13
$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;
return $noms_erreur;
}
$this->traiterResultatTest($info);
}
/**
* 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,24 → 447,13
$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;
return $noms_erreur;
}
$this->traiterResultatTest($info);
}
/**
* Test #10
*/
private function testerExitenceTaxonSuperieur() {
$info = $this->getInfosTest(10);
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
483,24 → 463,13
}
}
}
// 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;
return $noms_erreur;
}
$this->traiterResultatTest($info);
}
/**
* Test #11
*/
private function testerClassificationRang() {
$info = $this->getInfosTest(11);
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
516,24 → 485,13
}
}
}
// 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;
return $noms_erreur;
}
$this->traiterResultatTest($info);
}
/**
* Test #12
*/
private function testerClassification() {
$info = $this->getInfosTest(12);
// Réalisation du test
$noms_erreur = array();
$this->noms_ok = array();
555,18 → 513,9
}
}
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;
return $noms_erreur;
}
$this->traiterResultatTest($info);
}
private function remonterClassif(&$nom) {
$this->detection_boucle_infini[$nom['num_nom']] = true;
if (preg_match('/^[0-9]*$/', $nom['num_tax_sup'])) {
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,25 → 554,13
$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;
return $noms_erreur;
}
$this->traiterResultatTest($info);
}
/**
* 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,25 → 574,13
}
}
}
// 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;
return $noms_erreur;
}
$this->traiterResultatTest($info);
}
/**
* 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,25 → 594,13
}
}
}
// 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;
return $noms_erreur;
}
$this->traiterResultatTest($info);
}
/**
* 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,26 → 623,13
}
}
}
// 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;
return $noms_erreur;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
/**
* 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,26 → 644,13
}
}
}
// 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;
return $noms_erreur;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
/**
* 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,25 → 667,13
}
}
}
// 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;
return $noms_erreur;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
/**
* Test #19
*/
private function testerNomSupraGeneriqueEspaces() {
$info = $this->getInfosTest(19);
// Réalisation du test
$noms_erreur = array();
foreach ($this->noms as &$nom) {
811,19 → 684,9
}
}
}
// 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;
return $noms_erreur;
}
$noms_erreur = null;
$this->traiterResultatTest($info);
}
/**
* Test #20
*/