Subversion Repositories Applications.referentiel

Rev

Rev 164 | Rev 167 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 164 Rev 165
Line 49... Line 49...
49
			$traitements_obsoletes = $this->traitementDao->getTraitementsObsoletes($this->projet, self::SCRIPT_NOM);
49
			$traitements_obsoletes = $this->traitementDao->getTraitementsObsoletes($this->projet, self::SCRIPT_NOM);
50
			if (isset($traitements_obsoletes)) {
50
			if (isset($traitements_obsoletes)) {
51
				Debug::printr('Supp. obsoletes:'.$this->traitementDao->supprimer($traitements_obsoletes));
51
				Debug::printr('Supp. obsoletes:'.$this->traitementDao->supprimer($traitements_obsoletes));
52
			}
52
			}
Line -... Line 53...
-
 
53
			
-
 
54
			$this->tableStructureDao = new TableStructureDao();
-
 
55
			$this->referentielDao = new ReferentielDao();
53
			
56
			
54
			// Lancement du test demandé
57
			// Lancement du test demandé
55
			$cmd = $this->getParam('a');
58
			$cmd = $this->getParam('a');
56
	    	switch ($cmd) {
59
	    	switch ($cmd) {
57
				case 'tout' :
-
 
58
					$this->tableStructureDao = new TableStructureDao();
-
 
59
					$this->referentielDao = new ReferentielDao();
60
				case 'tout' :
-
 
61
					Debug::printr('Départ lancement test:');
60
					Debug::printr('Départ lancement test:');
62
					$this->recupererDonnees();
61
					$this->lancerTests();
63
					$this->lancerTests();
-
 
64
					break;
-
 
65
				case 'test11' :
-
 
66
					$this->recupererDonnees();
-
 
67
					Debug::printr('Départ lancement test 11 :');
-
 
68
					$this->testerClassificationRang();
62
					break;
69
					break;
63
				default :
70
				default :
64
					$this->traiterErreur('Erreur : la commande "%s" n\'existe pas!', array($cmd));
71
					$this->traiterErreur('Erreur : la commande "%s" n\'existe pas!', array($cmd));
65
			}
72
			}
66
			// Écriture de la date de fin du traitement
73
			// Écriture de la date de fin du traitement
67
			Debug::printr('Termine:'.$this->traitementDao->terminerTraitement($this->traitement['id_traitement']));
74
			Debug::printr('Termine:'.$this->traitementDao->terminerTraitement($this->traitement['id_traitement']));
68
		} else {
75
		} else {
69
			Debug::printr("Aucun dernier traitement trouvé pour le script '".self::SCRIPT_NOM."' !");
76
			Debug::printr("Aucun dernier traitement trouvé pour le script '".self::SCRIPT_NOM."' !");
70
		}
77
		}
Line 71... Line 78...
71
    }
78
    }
72
 
-
 
73
    public function lancerTests() {
-
 
74
		$donnees = array();
-
 
75
		$donnees['tests'] = array();
79
    
76
		
80
    public function recupererDonnees() {
77
		// Récupération des données à tester
81
		// Récupération des données à tester
78
		$colonnes = $this->tableStructureDao->getColonnes($this->projet);
82
		$colonnes = $this->tableStructureDao->getColonnes($this->projet);
79
		$analyses = $this->tableStructureDao->getAnalyse($this->projet);
83
		$analyses = $this->tableStructureDao->getAnalyse($this->projet);
-
 
84
		$this->noms = $this->referentielDao->getTout($this->projet);
Line -... Line 85...
-
 
85
		Debug::printr('Nbre noms :'.count($this->noms));
80
		$this->noms = $this->referentielDao->getTout($this->projet);
86
    }
81
		Debug::printr('Nbre noms :'.count($this->noms));
87
    
82
		
88
    public function lancerTests() {
83
		// Lancement des tests unitaires
89
		// Lancement des tests unitaires
84
		$resultats = array();
90
		$resultats = array();
Line 1499... Line 1505...
1499
	}
1505
	}
Line 1500... Line 1506...
1500
	
1506
	
1501
	private function testerClassificationRang() {
1507
	private function testerClassificationRang() {
1502
		$info = array('nom' => 'Classification -> taxon supérieur avec rang inférieur',
1508
		$info = array('nom' => 'Classification -> taxon supérieur avec rang inférieur',
1503
			'description' => "Pour chaque enregistrement représentant un taxon, le taxon supérieur doit avoir ".
1509
			'description' => "Pour chaque enregistrement représentant un taxon, le taxon supérieur doit avoir ".
1504
								"un rang inférieur au taxon courant.",
1510
								"un rang inférieur au taxon courant (à l'exception des noms ayant le rang de Clade).",
Line 1505... Line 1511...
1505
			'resultat' => false);
1511
			'resultat' => false);
1506
		
1512
		
1507
		// Réalisation du test
1513
		// Réalisation du test
1508
		$noms_erreur = array();
1514
		$noms_erreur = array();
1509
		foreach ($this->noms as &$nom) {
1515
		foreach ($this->noms as &$nom) {
1510
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
1516
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
1511
				if (isset($this->noms[$nom['num_tax_sup']])) {
1517
				if (isset($this->noms[$nom['num_tax_sup']])) {
-
 
1518
					$nom_sup = $this->noms[$nom['num_tax_sup']];
-
 
1519
					if ($nom_sup['rang'] >= $nom['rang']) {
1512
					$nom_sup = $this->noms[$nom['num_tax_sup']];
1520
						// Prise en compte de l'exception des clades
1513
					if ($nom_sup['rang'] > $nom['rang']) {
1521
						if (! ($nom_sup['rang'] == 70 && $nom['rang'] == 70)) {
1514
						$noms_erreur[] = $nom['num_nom'];
1522
							$noms_erreur[] = $nom['num_nom'];
1515
					}
1523
						}
1516
				}
1524
					}
-
 
1525
				}
Line 1517... Line 1526...
1517
			}
1526
			}
1518
		}
1527
		}
1519
		
1528
		
1520
		// Analyse des résultats
1529
		// Analyse des résultats