Subversion Repositories Applications.referentiel

Rev

Rev 174 | Rev 176 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 174 Rev 175
Line 87... Line 87...
87
		$this->analyses = $this->tableStructureDao->getAnalyse($this->projet);
87
		$this->analyses = $this->tableStructureDao->getAnalyse($this->projet);
88
		$this->noms = $this->referentielDao->getTout($this->projet);
88
		$this->noms = $this->referentielDao->getTout($this->projet);
89
		Debug::printr('Nbre noms :'.count($this->noms));
89
		Debug::printr('Nbre noms :'.count($this->noms));
90
    }
90
    }
Line -... Line 91...
-
 
91
    
-
 
92
    public function lancerTestsAuto() {
-
 
93
		$resultats = array();
-
 
94
 
-
 
95
		// Lancement des tests unitaires
-
 
96
    	foreach (array_keys($this->tests) as $numero) {
-
 
97
			$info = $this->getInfosTest($numero);
-
 
98
    		
-
 
99
    		if ($numero < 5) {
-
 
100
    			// Tests spéciaux vérifiant la structure de la table
-
 
101
    			$resultats[] = $this->lancerTestUnitaire($info);
-
 
102
    		} else if ($numero >= 5 && $this->verifierResultats($resultats)) {		
-
 
103
				// Si la structure est bonne nous lançons les autres tests
-
 
104
				
-
 
105
    		}
-
 
106
		}
-
 
107
    }
-
 
108
    
-
 
109
    public function lancerTestUnitaire($info) {
-
 
110
		$methodeDeTest = $info['methode'];
-
 
111
    	$erreurs = $this->$methodeDeTest;
-
 
112
    	
-
 
113
    	// Analyse des résultats
-
 
114
    	if (isset($erreurs['special'])) {
-
 
115
    		$info = $erreurs;
-
 
116
    	} else {
-
 
117
			if (count($erreurs) > 0) {
-
 
118
				$info['message']['entete'] = explode(',', $info['entete']);
-
 
119
				$info['message']['lignes'] = $erreurs;
-
 
120
			} else {
-
 
121
				$info['resultat'] = true;
-
 
122
			}
-
 
123
    	}
-
 
124
    	
-
 
125
		$this->traiterResultatTest($info);
-
 
126
		
-
 
127
		if ($info['numero'] < 5) {
-
 
128
			return ($info['resultat'] ? '1' : '0');
-
 
129
		}
-
 
130
    }
91
    
131
    
92
    public function lancerTests() {
132
    public function lancerTests() {
93
		// Lancement des tests unitaires
133
		// Lancement des tests unitaires
94
		$resultats = array();
134
		$resultats = array();
95
		$resultats[] = $this->testerNombreDeChamps($this->colonnes);
135
		$resultats[] = $this->testerNombreDeChamps();
96
		$resultats[] = $this->testerNomDesChamps($this->colonnes);
136
		$resultats[] = $this->testerNomDesChamps();
97
		$resultats[] = $this->testerTypeDesChamps($this->colonnes);
137
		$resultats[] = $this->testerTypeDesChamps();
Line 98... Line 138...
98
		$resultats[] = $this->testerNumNomClePrimaire($this->colonnes);
138
		$resultats[] = $this->testerNumNomClePrimaire();
99
		
139
		
100
		// Si la structure est bonne nous lançons les autres tests
140
		// Si la structure est bonne nous lançons les autres tests
101
		Debug::printr($resultats);
141
		Debug::printr($resultats);
Line 102... Line 142...
102
		if ($this->verifierResultats($resultats)) {
142
		if ($this->verifierResultats($resultats)) {
Line 103... Line 143...
103
			$this->testerTailleDesChamps($this->colonnes, $this->analyses);
143
			$this->testerTailleDesChamps();
104
			
144
			
Line 185... Line 225...
185
			$this->testerStatutIntroductionSyntaxe();
225
			$this->testerStatutIntroductionSyntaxe();
186
			$this->testerStatutCultureSyntaxe();
226
			$this->testerStatutCultureSyntaxe();
187
			$this->testerExclureTaxRefSyntaxe();
227
			$this->testerExclureTaxRefSyntaxe();
188
		}
228
		}
189
	}
229
	}
-
 
230
	
190
	private function verifierResultats($resultats) {
231
	private function verifierResultats($resultats) {
191
		$ok = true;
232
		$ok = true;
192
		foreach ($resultats as $resultat) {
233
		foreach ($resultats as $resultat) {
193
			if ($resultat == '0') {
234
			if ($resultat == '0') {
194
				$ok = false;
235
				$ok = false;
Line 217... Line 258...
217
	// TESTS
258
	// TESTS
Line 218... Line 259...
218
	
259
	
219
	/**
260
	/**
220
	 * Test #01
261
	 * Test #01
221
	 */
262
	 */
222
	private function testerNombreDeChamps($colonnes) {
263
	private function testerNombreDeChamps() {
-
 
264
		$info = $this->getInfosTest(1);
Line 223... Line 265...
223
		$info = $this->getInfosTest(1);
265
		$info['special'] = true;
224
		
266
		
225
		$nbre_colonnes = count($colonnes);
267
		$nbre_colonnes = count($this->colonnes);
226
		$info['message'] = $nbre_colonnes;
268
		$info['message'] = $nbre_colonnes;
227
		if ($nbre_colonnes >= 35) {
269
		if ($nbre_colonnes >= 35) {
228
			$info['resultat'] = true;
-
 
-
 
270
			$info['resultat'] = true;
229
		}
271
		}
230
		$this->traiterResultatTest($info);
272
		
Line 231... Line 273...
231
		return ($info['resultat'] ? '1' : '0');
273
		return $info;
232
	}
274
	}
233
	
275
	
234
	/**
276
	/**
235
	 * Test #02
277
	 * Test #02
-
 
278
	 */
Line 236... Line 279...
236
	 */
279
	private function testerNomDesChamps() {
237
	private function testerNomDesChamps($colonnes) {
280
		$info = $this->getInfosTest(2);
238
		$info = $this->getInfosTest(2);
281
		$info['special'] = true;
239
		
282
		
240
		$champs_attendus = explode(',', $this->manuel['champs']);
283
		$champs_attendus = explode(',', $this->manuel['champs']);
Line 241... Line 284...
241
		$champs_presents = array();
284
		$champs_presents = array();
242
		foreach ($colonnes as $colonne) {
285
		foreach ($this->colonnes as $colonne) {
Line 249... Line 292...
249
			if (!isset($champs_presents[$champ_attendu])) {
292
			if (!isset($champs_presents[$champ_attendu])) {
250
				$champs_manquant[] = $champ_attendu; 
293
				$champs_manquant[] = $champ_attendu; 
251
				$ok = false;
294
				$ok = false;
252
			}
295
			}
253
		}
296
		}
-
 
297
		
254
		$info['resultat'] = $ok;
298
		$info['resultat'] = $ok;
255
		if (!$ok) {
299
		if (!$ok) {
256
			$info['message'] = sprintf($info['message'], implode(', ', $champs_manquant));
300
			$info['message'] = sprintf($info['message'], implode(', ', $champs_manquant));
257
		}
301
		}
Line 258... Line -...
258
		
-
 
259
		$this->traiterResultatTest($info);
302
		
260
		return ($info['resultat'] ? '1' : '0');
303
		return $info;
Line 261... Line 304...
261
	}
304
	}
262
	
305
	
263
	/**
306
	/**
264
	 * Test #03
307
	 * Test #03
265
	 */
-
 
266
	private function testerTypeDesChamps($colonnes) {
-
 
267
		$info = $this->getInfosTest(3);
308
	 */
268
		
309
	private function testerTypeDesChamps() {
269
		$champs_attendus = explode(',', $this->manuel['champs_type']);
310
		$champs_attendus = explode(',', $this->manuel['champs_type']);
270
		$champs_presents = array();
311
		$champs_presents = array();
271
		foreach ($colonnes as $colonne) {
312
		foreach ($this->colonnes as $colonne) {
Line 272... Line 313...
272
			$champs_presents[$colonne['Field']] = $colonne['Type'];
313
			$champs_presents[$colonne['Field']] = $colonne['Type'];
273
		}
314
		}
Line 283... Line 324...
283
				
324
				
284
				if (($champ_attendu_type == 'VARCHAR' && strstr($champs_present_type, 'varchar') === false)
325
				if (($champ_attendu_type == 'VARCHAR' && strstr($champs_present_type, 'varchar') === false)
285
					|| ($champ_attendu_type == 'TEXT' && strstr($champs_present_type, 'text') === false)
326
					|| ($champ_attendu_type == 'TEXT' && strstr($champs_present_type, 'text') === false)
286
					|| ($champ_attendu_type == 'INT' && strstr($champs_present_type, 'int') === false) 
327
					|| ($champ_attendu_type == 'INT' && strstr($champs_present_type, 'int') === false) 
287
					|| ($champ_attendu_type == 'BOOL' && preg_match('/(?:bool|boolean|tinyint\(1\))/i', $champs_present_type) === false)) {
328
					|| ($champ_attendu_type == 'BOOL' && preg_match('/(?:bool|boolean|tinyint\(1\))/i', $champs_present_type) === false)) {
288
					$champs_erreur[] = $champ_attendu." vaut ".$champs_present_type;
329
					$champs_erreur[] = array($champ_attendu, $champ_attendu_type, $champs_present_type);
289
				}
330
				}
290
			}
331
			}
291
		}
-
 
292
		
-
 
293
		// Analyse des résultats
332
		}
294
		if (count($champs_erreur) > 0) {
-
 
295
			$info['message'] = sprintf($info['message'], implode(', ', $champs_erreur));
-
 
296
		} else {
-
 
297
			$info['resultat'] = true;
-
 
298
		}
-
 
299
		
-
 
300
		$this->traiterResultatTest($info);
-
 
301
		return ($info['resultat'] ? '1' : '0');
333
		return $champs_erreur;
Line 302... Line 334...
302
	}
334
	}
303
	
335
	
304
	/**
336
	/**
305
	 * Test #04
337
	 * Test #04
306
	 */
338
	 */
-
 
339
	private function testerNumNomClePrimaire() {
Line 307... Line 340...
307
	private function testerNumNomClePrimaire($colonnes) {
340
		$info = $this->getInfosTest(4);
308
		$info = $this->getInfosTest(4);
341
		$info['special'] = true;
309
		
342
		
310
		foreach ($colonnes as $colonne) {
343
		foreach ($this->colonnes as $colonne) {
311
			if ($colonne['Field'] == 'num_nom' && $colonne['Key'] == 'PRI') {
344
			if ($colonne['Field'] == 'num_nom' && $colonne['Key'] == 'PRI') {
312
				$info['resultat'] = true;
-
 
313
			}
-
 
314
		}
345
				$info['resultat'] = true;
315
		
346
			}
Line 316... Line 347...
316
		$this->traiterResultatTest($info);
347
		}
317
		return ($info['resultat'] ? '1' : '0');
348
		return $info;
318
	}
349
	}
319
	
350
	
320
	
-
 
321
	/**
-
 
322
	 * Test #05
351
	
323
	 */
352
	/**
324
	private function testerTailleDesChamps($colonnes, $analyses) {
353
	 * Test #05
325
		$info = $this->getInfosTest(5);
354
	 */
326
		
355
	private function testerTailleDesChamps() {
327
		$tailles_champs_maxi = array();
356
		$tailles_champs_maxi = array();
Line 328... Line 357...
328
		foreach ($colonnes as $colonne) {
357
		foreach ($this->colonnes as $colonne) {
329
			if (preg_match('/^varchar\(([0-9]+)\)$/', $colonne['Type'], $match)) {
358
			if (preg_match('/^varchar\(([0-9]+)\)$/', $colonne['Type'], $match)) {
330
				$tailles_champs_maxi[$colonne['Field']] = $match[1];
359
				$tailles_champs_maxi[$colonne['Field']] = $match[1];
331
			}
360
			}
332
		}
361
		}
333
		
362
		
Line 334... Line 363...
334
		$tailles_trouvees = array();
363
		$tailles_trouvees = array();
335
		foreach ($analyses as $analyse) {
364
		foreach ($this->analyses as $analyse) {
336
			if (preg_match('/\.([^.]+)$/', $analyse['Field_name'], $match)) {
365
			if (preg_match('/\.([^.]+)$/', $analyse['Field_name'], $match)) {
337
				$tailles_trouvees[$match[1]] = $analyse['Max_length'];
366
				$tailles_trouvees[$match[1]] = $analyse['Max_length'];
338
			}
367
			}
339
		}
368
		}
340
		
369
		
341
		$champs_erreur = array();
370
		$champs_erreur = array();
342
		$champs_attendus = explode(',', $this->manuel['champs']);
371
		$champs_attendus = explode(',', $this->manuel['champs']);
343
		foreach ($champs_attendus as $champ_attendu) {
-
 
344
			if (isset($tailles_champs_maxi[$champ_attendu]) && isset($tailles_trouvees[$champ_attendu])) {
-
 
345
				if ($tailles_champs_maxi[$champ_attendu] == $tailles_trouvees[$champ_attendu]) {
372
		foreach ($champs_attendus as $champ_attendu) {
346
					$champs_erreur[] = $champ_attendu;
-
 
347
				}
-
 
348
			}
-
 
349
		}
-
 
350
		
-
 
351
		// Analyse des résultats
-
 
352
		if (count($champs_erreur) > 0) {
373
			if (isset($tailles_champs_maxi[$champ_attendu]) && isset($tailles_trouvees[$champ_attendu])) {
Line 353... Line 374...
353
			$info['message'] = sprintf($info['message'], implode(', ', $champs_erreur));
374
				if ($tailles_champs_maxi[$champ_attendu] == $tailles_trouvees[$champ_attendu]) {
354
		} else {
375
					$champs_erreur[] = array($champ_attendu, $tailles_champs_maxi[$champ_attendu], $tailles_trouvees[$champ_attendu]);
355
			$info['resultat'] = true;
376
				}
356
		}
377
			}
357
		
-
 
358
		$this->traiterResultatTest($info);
-
 
359
	}
378
		}
360
		
379
		return $champs_erreur;
361
	/**
380
	}
362
	 * Test #06
381
		
363
	 */
382
	/**
364
	private function testerNumNomSuperieurAZero() {
383
	 * Test #06
365
		$info = $this->getInfosTest(6);
384
	 */
366
		
-
 
367
		// Réalisation du test
-
 
368
		$noms_erreur = array();
385
	private function testerNumNomSuperieurAZero() {
369
		foreach ($this->noms as &$nom) {
-
 
370
			if ($nom['num_nom'] <= 0) {
-
 
371
				$noms_erreur[] = $nom['num_nom'];
-
 
372
			}
-
 
373
		}
-
 
374
		
-
 
375
		// Analyse des résultats
386
		// Réalisation du test
Line 376... Line 387...
376
		if (count($noms_erreur) > 0) {
387
		$noms_erreur = array();
377
			$info['message'] = sprintf($info['message'], count($noms_erreur));
388
		foreach ($this->noms as &$nom) {
378
		} else {
389
			if ($nom['num_nom'] <= 0) {
Line 390... Line 401...
390
		
401
		
391
		// Réalisation du test
402
		// Réalisation du test
392
		$noms_erreur = array();
403
		$noms_erreur = array();
393
		foreach ($this->noms as &$nom) {
404
		foreach ($this->noms as &$nom) {
394
			if ($nom['num_nom_retenu'] != '' && $nom['num_nom_retenu'] <= 0) {
405
			if ($nom['num_nom_retenu'] != '' && $nom['num_nom_retenu'] <= 0) {
395
				$noms_erreur[] = $nom['num_nom'];
406
				$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu']);
396
			}
407
			}
Line 397... Line 408...
397
		}
408
		}
398
		
409
		
399
		// Analyse des résultats
410
		// Analyse des résultats
-
 
411
		if (count($noms_erreur) > 0) {
400
		if (count($noms_erreur) > 0) {
412
			$info['message']['entete'] = array('num_nom', 'num_nom_retenu');
401
			$info['message'] = sprintf($info['message'], count($noms_erreur), implode(', ', $noms_erreur));
413
			$info['message']['lignes'] = $noms_erreur;
402
		} else {
414
		} else {
Line 403... Line 415...
403
			$info['resultat'] = true;
415
			$info['resultat'] = true;
Line 414... Line 426...
414
		
426
		
415
		// Réalisation du test
427
		// Réalisation du test
416
		$noms_erreur = array();
428
		$noms_erreur = array();
417
		foreach ($this->noms as &$nom) {
429
		foreach ($this->noms as &$nom) {
418
			if (preg_match('/^0$/', $nom['num_tax_sup'])) {
430
			if (preg_match('/^0$/', $nom['num_tax_sup'])) {
419
				$noms_erreur[] = $nom['num_nom'];
431
				$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup']);
420
			}
432
			}
Line 421... Line 433...
421
		}
433
		}
422
		
434
		
423
		// Analyse des résultats
435
		// Analyse des résultats
-
 
436
		if (count($noms_erreur) > 1) {
424
		if (count($noms_erreur) > 1) {
437
			$info['message']['entete'] = array('num_nom', 'num_tax_sup');
425
			$info['message'] = sprintf($info['message'], count($noms_erreur), implode(', ', $noms_erreur));
438
			$info['message']['lignes'] = $noms_erreur;
426
		} else {
439
		} else {
Line 427... Line 440...
427
			$info['resultat'] = true;
440
			$info['resultat'] = true;
Line 438... Line 451...
438
		
451
		
439
		// Réalisation du test
452
		// Réalisation du test
440
		$noms_erreur = array();
453
		$noms_erreur = array();
441
		foreach ($this->noms as &$nom) {
454
		foreach ($this->noms as &$nom) {
442
			if ($nom['num_nom_retenu'] != $nom['num_nom'] && $nom['num_tax_sup'] != '') {
455
			if ($nom['num_nom_retenu'] != $nom['num_nom'] && $nom['num_tax_sup'] != '') {
443
				$noms_erreur[] = $nom['num_nom']; 
456
				$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup']); 
444
			}
457
			}
Line 445... Line 458...
445
		}
458
		}
446
		
459
		
447
		// Analyse des résultats
460
		// Analyse des résultats
-
 
461
		if (count($noms_erreur) > 0) {
448
		if (count($noms_erreur) > 0) {
462
			$info['message']['entete'] = array('num_nom', 'num_tax_sup');
449
			$info['message'] = sprintf($info['message'], count($noms_erreur), implode(', ', $noms_erreur));
463
			$info['message']['lignes'] = $noms_erreur;
450
		} else {
464
		} else {
Line 451... Line 465...
451
			$info['resultat'] = true;
465
			$info['resultat'] = true;
Line 463... Line 477...
463
		// Réalisation du test
477
		// Réalisation du test
464
		$noms_erreur = array();
478
		$noms_erreur = array();
465
		foreach ($this->noms as &$nom) {
479
		foreach ($this->noms as &$nom) {
466
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
480
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
467
				if ($nom['num_tax_sup'] != 0 && !isset($this->noms[$nom['num_tax_sup']])) {
481
				if ($nom['num_tax_sup'] != 0 && !isset($this->noms[$nom['num_tax_sup']])) {
468
					$noms_erreur[] = $nom['num_nom'];
482
					$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup']);
469
				} 
483
				} 
470
			}
484
			}
471
		}
485
		}
Line 472... Line 486...
472
		
486
		
473
		// Analyse des résultats
487
		// Analyse des résultats
474
		if (count($noms_erreur) > 0) {
488
		if (count($noms_erreur) > 0) {
-
 
489
			$info['message']['entete'] = array('num_nom', 'num_tax_sup');
475
			$info['message'] = sprintf($info['message'], count($noms_erreur), implode(', ', $noms_erreur));
490
			$info['message']['lignes'] = $noms_erreur;
476
		} else {
491
		} else {
477
			$info['resultat'] = true;
492
			$info['resultat'] = true;
Line 478... Line 493...
478
		}
493
		}
Line 493... Line 508...
493
				if (isset($this->noms[$nom['num_tax_sup']])) {
508
				if (isset($this->noms[$nom['num_tax_sup']])) {
494
					$nom_sup = $this->noms[$nom['num_tax_sup']];
509
					$nom_sup = $this->noms[$nom['num_tax_sup']];
495
					if ($nom_sup['rang'] >= $nom['rang']) {
510
					if ($nom_sup['rang'] >= $nom['rang']) {
496
						// Prise en compte de l'exception des clades
511
						// Prise en compte de l'exception des clades
497
						if (! ($nom_sup['rang'] == 70 && $nom['rang'] == 70)) {
512
						if (! ($nom_sup['rang'] == 70 && $nom['rang'] == 70)) {
498
							$noms_erreur[] = $nom['num_nom'];
513
							$noms_erreur[] = array($nom['num_nom'], $nom['rang'], $nom_sup['num_nom'], $nom_sup['rang']);
499
						}
514
						}
500
					}
515
					}
501
				}
516
				}
502
			}
517
			}
503
		}
518
		}
Line 504... Line 519...
504
		
519
		
505
		// Analyse des résultats
520
		// Analyse des résultats
506
		if (count($noms_erreur) > 0) {
521
		if (count($noms_erreur) > 0) {
-
 
522
			$info['message']['entete'] = array('num_nom', 'rang', 'Taxon supérieur num_nom', 'Taxon supérieur rang');
507
			$info['message'] = sprintf($info['message'], count($noms_erreur), implode(', ', $noms_erreur));
523
			$info['message']['lignes'] = $noms_erreur;
508
		} else {
524
		} else {
509
			$info['resultat'] = true;
525
			$info['resultat'] = true;
Line 510... Line 526...
510
		}
526
		}
Line 528... Line 544...
528
				} else {
544
				} else {
529
					$this->detection_boucle_infini = array();
545
					$this->detection_boucle_infini = array();
530
					$classif_ok = $this->remonterClassif($nom);
546
					$classif_ok = $this->remonterClassif($nom);
531
					unset($this->detection_boucle_infini); 
547
					unset($this->detection_boucle_infini); 
Line 532... Line 548...
532
					
548
					
533
					if ($classif_ok === false) {
-
 
534
						$noms_erreur[] = $nom['num_nom'];
-
 
535
					} else {
549
					if ($classif_ok === true) {
-
 
550
						$this->noms_ok[$nom['num_nom']] = $classif_ok;
-
 
551
					} else {
536
						$this->noms_ok[$nom['num_nom']] = $classif_ok;
552
						$noms_erreur[] = array($nom['num_nom'], $classif_ok);
537
					}
553
					}
538
				}
554
				}
539
			}
555
			}
540
		}
556
		}
Line 541... Line 557...
541
		unset($this->noms_ok);
557
		unset($this->noms_ok);
542
		
558
		
543
		// Analyse des résultats
559
		// Analyse des résultats
-
 
560
		if (count($noms_erreur) > 0) {
544
		if (count($noms_erreur) > 0) {
561
			$info['message']['entete'] = array('num_nom', 'Message du problème');
545
			$info['message'] = sprintf($info['message'], count($noms_erreur), implode(', ', $noms_erreur));
562
			$info['message']['lignes'] = $noms_erreur;
546
		} else {
563
		} else {
Line 547... Line 564...
547
			$info['resultat'] = true;
564
			$info['resultat'] = true;
Line 558... Line 575...
558
				return true;
575
				return true;
559
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] == '0') {
576
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] == '0') {
560
				$this->noms_ok[$nom['num_nom']] = true;
577
				$this->noms_ok[$nom['num_nom']] = true;
561
				return true;
578
				return true;
562
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] != '0') {
579
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] != '0') {
563
				return false;
580
				return 'Hiérarchie avec le taxon #'.$nom['num_nom'].' ayant un taxon superieur #'.$nom['num_tax_sup'].' inexistant';
564
			} else if (isset($this->detection_boucle_infini[$nom['num_tax_sup']])) {
581
			} else if (isset($this->detection_boucle_infini[$nom['num_tax_sup']])) {
565
				return false;
582
				return 'Boucle infinie pour le taxon #'.$nom['num_tax_sup'];
566
			} else {
583
			} else {
567
				$retour = $this->remonterClassif($this->noms[$nom['num_tax_sup']]);
584
				$retour = $this->remonterClassif($this->noms[$nom['num_tax_sup']]);
568
				if ($retour === true) {
585
				if ($retour === true) {
569
					$this->noms_ok[$nom['num_tax_sup']] = true;
586
					$this->noms_ok[$nom['num_tax_sup']] = true;
570
				}
587
				}
571
				return $retour;
588
				return $retour;
572
			}
589
			}
573
		} else {
590
		} else {
574
			return false;
591
			return 'Valeur num_tax_sup incorrecte : '.$nom['num_tax_sup'];
575
		}
592
		}
576
	}
593
	}
Line 577... Line 594...
577
	
594
	
578
	/**
595
	/**
Line 585... Line 602...
585
		
602
		
586
		// Réalisation du test
603
		// Réalisation du test
587
		$noms_erreur = array();
604
		$noms_erreur = array();
588
		foreach ($this->noms as &$nom) {
605
		foreach ($this->noms as &$nom) {
589
			if (!isset($rangs[$nom['rang']])) {
606
			if (!isset($rangs[$nom['rang']])) {
590
				$noms_erreur[] = $nom['num_nom'];
607
				$noms_erreur[] = array($nom['num_nom'], $nom['rang']);
591
			}
608
			}
Line 592... Line 609...
592
		}
609
		}
593
		
610
		
594
		// Analyse des résultats
611
		// Analyse des résultats
-
 
612
		if (count($noms_erreur) > 0) {
595
		if (count($noms_erreur) > 0) {
613
			$info['message']['entete'] = array('num_nom', 'Rang');
596
			$info['message'] = sprintf($info['message'], count($noms_erreur), implode(', ', $noms_erreur));
614
			$info['message']['lignes'] = $noms_erreur;
597
		} else {
615
		} else {
Line 598... Line 616...
598
			$info['resultat'] = true;
616
			$info['resultat'] = true;
Line 1712... Line 1730...
1712
	
1730
	
1713
	/**
1731
	/**
1714
	 * Test #51
1732
	 * Test #51
1715
	 */
1733
	 */
1716
	private function testerSynonymeProparteExistence() {
-
 
1717
		$info = array('nom' => 'synonyme_proparte -> existence',
-
 
1718
			'description' => "Si le champ synonyme_proparte contient un ou plusieurs nombres alors chacun d'entre eux ".
-
 
1719
								"doit correspondre à une valeur du champ num_nom.",
1734
	private function testerSynonymeProparteExistence() {
Line 1720... Line 1735...
1720
			'resultat' => false);
1735
		$info = $this->getInfosTest(51);
1721
		
1736
		
1722
		// Réalisation du test
1737
		// Réalisation du test
1723
		$noms_erreur = array();
1738
		$noms_erreur = array();
Line 1750... Line 1765...
1750
	
1765
	
1751
	/**
1766
	/**
1752
	 * Test #52
1767
	 * Test #52
1753
	 */
1768
	 */
1754
	private function testerSynonymeDouteuxSyntaxe() {
-
 
1755
		$info = array('nom' => 'synonyme_douteux -> syntaxe',
-
 
1756
			'description' => "Le champ synonyme_douteux contient soit :\n".
-
 
1757
			" - une valeur vide,\n".
-
 
1758
			" - le chiffre 1.",
1769
	private function testerSynonymeDouteuxSyntaxe() {
Line 1759... Line 1770...
1759
			'resultat' => false);
1770
		$info = $this->getInfosTest(52);
1760
		
1771
		
1761
		// Réalisation du test
1772
		// Réalisation du test
1762
		$noms_erreur = array();
1773
		$noms_erreur = array();
Line 1782... Line 1793...
1782
	
1793
	
1783
	/**
1794
	/**
1784
	 * Test #53
1795
	 * Test #53
1785
	 */
1796
	 */
1786
	private function testerSynonymeDouteuxNumNomRetenu() {
-
 
1787
		$info = array('nom' => 'synonyme_douteux -> présence num_nom_retenu',
-
 
1788
			'description' => "Si le nom est un synonyme douteux, le champs num_nom_retenu doit être vide.",
1797
	private function testerSynonymeDouteuxNumNomRetenu() {
Line 1789... Line 1798...
1789
			'resultat' => false);
1798
		$info = $this->getInfosTest(53);
1790
		
1799
		
1791
		// Réalisation du test
1800
		// Réalisation du test
1792
		$noms_erreur = array();
1801
		$noms_erreur = array();
Line 1809... Line 1818...
1809
	
1818
	
1810
	/**
1819
	/**
1811
	 * Test #54
1820
	 * Test #54
1812
	 */
1821
	 */
1813
	private function testerSynonymeMalAppliqueSyntaxe() {
-
 
1814
		$info = array('nom' => 'synonyme_mal_applique -> syntaxe',
-
 
1815
			'description' => "Le champ synonyme_mal_applique contient soit :\n".
-
 
1816
			" - une valeur vide,\n".
-
 
1817
			" - le chiffre 1.",
1822
	private function testerSynonymeMalAppliqueSyntaxe() {
Line 1818... Line 1823...
1818
			'resultat' => false);
1823
		$info = $this->getInfosTest(54);
1819
		
1824
		
1820
		// Réalisation du test
1825
		// Réalisation du test
1821
		$noms_erreur = array();
1826
		$noms_erreur = array();
Line 1841... Line 1846...
1841
	
1846
	
1842
	/**
1847
	/**
1843
	 * Test #55
1848
	 * Test #55
1844
	 */
1849
	 */
1845
	private function testerSynonymeOrthographiqueSyntaxe() {
-
 
1846
		$info = array('nom' => 'synonyme_orthographique -> syntaxe',
-
 
1847
			'description' => "Le champ synonyme_orthographique contient soit :\n".
-
 
1848
								" - une valeur vide,\n".
-
 
1849
								" - un nombre.",
1850
	private function testerSynonymeOrthographiqueSyntaxe() {
Line 1850... Line 1851...
1850
			'resultat' => false);
1851
		$info = $this->getInfosTest(55);
1851
		
1852
		
1852
		// Réalisation du test
1853
		// Réalisation du test
1853
		$noms_erreur = array();
1854
		$noms_erreur = array();
Line 1873... Line 1874...
1873
	
1874
	
1874
	/**
1875
	/**
1875
	 * Test #56
1876
	 * Test #56
1876
	 */
1877
	 */
1877
	private function testerSynonymeOrthographiqueExistence() {
-
 
1878
		$info = array('nom' => 'synonyme_orthographique -> existence',
-
 
1879
			'description' => "Si le champ synonyme_orthographique contient un nombre alors il doit correspondre ".
-
 
1880
								"à une valeur du champ num_nom.",
1878
	private function testerSynonymeOrthographiqueExistence() {
Line 1881... Line 1879...
1881
			'resultat' => false);
1879
		$info = $this->getInfosTest(56);
1882
		
1880
		
1883
		// Réalisation du test
1881
		// Réalisation du test
1884
		$noms_erreur = array();
1882
		$noms_erreur = array();
Line 1904... Line 1902...
1904
	
1902
	
1905
	/**
1903
	/**
1906
	 * Test #57
1904
	 * Test #57
1907
	 */
1905
	 */
1908
	private function testerHybrideParent01Syntaxe() {
-
 
1909
		$info = array('nom' => 'hybride_parent_01 -> syntaxe',
-
 
1910
			'description' => "Le champ hybride_parent_01 contient soit :\n".
-
 
1911
								" - une valeur vide,\n".
-
 
1912
								" - un nombre.",
1906
	private function testerHybrideParent01Syntaxe() {
Line 1913... Line 1907...
1913
			'resultat' => false);
1907
		$info = $this->getInfosTest(57);
1914
		
1908
		
1915
		// Réalisation du test
1909
		// Réalisation du test
1916
		$noms_erreur = array();
1910
		$noms_erreur = array();
Line 1936... Line 1930...
1936
	
1930
	
1937
	/**
1931
	/**
1938
	 * Test #58
1932
	 * Test #58
1939
	 */
1933
	 */
1940
	private function testerHybrideParent01Existence() {
-
 
1941
		$info = array('nom' => 'hybride_parent_01 -> existence',
-
 
1942
			'description' => "Si le champ hybride_parent_01 contient un nombre alors il doit correspondre à une valeur ".
-
 
1943
								"du champ num_nom.",
1934
	private function testerHybrideParent01Existence() {
Line 1944... Line 1935...
1944
			'resultat' => false);
1935
		$info = $this->getInfosTest(58);
1945
		
1936
		
1946
		// Réalisation du test
1937
		// Réalisation du test
1947
		$noms_erreur = array();
1938
		$noms_erreur = array();
Line 1967... Line 1958...
1967
	
1958
	
1968
	/**
1959
	/**
1969
	 * Test #59
1960
	 * Test #59
1970
	 */
1961
	 */
1971
	private function testerHybrideParent02Syntaxe() {
-
 
1972
		$info = array('nom' => 'hybride_parent_02 -> syntaxe',
-
 
1973
			'description' => "Le champ hybride_parent_02 contient soit :\n".
-
 
1974
								" - une valeur vide,\n".
-
 
1975
								" - un nombre.",
1962
	private function testerHybrideParent02Syntaxe() {
Line 1976... Line 1963...
1976
			'resultat' => false);
1963
		$info = $this->getInfosTest(59);
1977
		
1964
		
1978
		// Réalisation du test
1965
		// Réalisation du test
1979
		$noms_erreur = array();
1966
		$noms_erreur = array();
Line 1999... Line 1986...
1999
	
1986
	
2000
	/**
1987
	/**
2001
	 * Test #60
1988
	 * Test #60
2002
	 */
1989
	 */
2003
	private function testerHybrideParent02Existence() {
-
 
2004
		$info = array('nom' => 'hybride_parent_02 -> existence',
-
 
2005
			'description' => "Si le champ hybride_parent_02 contient un nombre alors il doit correspondre à une valeur ".
-
 
2006
								"du champ num_nom.",
1990
	private function testerHybrideParent02Existence() {
Line 2007... Line 1991...
2007
			'resultat' => false);
1991
		$info = $this->getInfosTest(60);
2008
		
1992
		
2009
		// Réalisation du test
1993
		// Réalisation du test
2010
		$noms_erreur = array();
1994
		$noms_erreur = array();
Line 2030... Line 2014...
2030
	
2014
	
2031
	/**
2015
	/**
2032
	 * Test #61
2016
	 * Test #61
2033
	 */
2017
	 */
2034
	private function testerPresenceSyntaxe() {
2018
	private function testerPresenceSyntaxe() {
2035
		$info = array('nom' => 'presence -> syntaxe',
-
 
2036
			'description' => "Le champ presence contient soit :\n".
-
 
2037
								" - le symbole tiret «-» précédant une autre information non référencée...\n".
-
 
2038
								" - une première lettre en majuscule indiquant le code standard attribué à ce taxon,\n".
-
 
2039
								" - éventuellement suivie d'un tiret puis d'une deuxième lettre en majuscule indiquant ".
-
 
2040
								"un code de présence spécifique au référentiel.",
-
 
Line 2041... Line 2019...
2041
			'resultat' => false);
2019
		$info = $this->getInfosTest(61);
2042
		
2020
		
2043
		// Réalisation du test
2021
		// Réalisation du test
2044
		$noms_erreur = array();
2022
		$noms_erreur = array();
Line 2064... Line 2042...
2064
	
2042
	
2065
	/**
2043
	/**
2066
	 * Test #62
2044
	 * Test #62
2067
	 */
2045
	 */
2068
	private function testerStatutOrigineSyntaxe() {
2046
	private function testerStatutOrigineSyntaxe() {
2069
		$info = array('nom' => 'statut_origine -> syntaxe',
-
 
2070
			'description' => "Le champ statut_origine peut contenir :\n".
-
 
2071
								" - le symbole tiret «-» précédant une autre information non référencée...\n".
-
 
2072
								" - une première lettre en majuscule indiquant le code standard attribué à ce taxon.\n".
-
 
2073
								" - éventuellement suivie d'un tiret puis d'une deuxième lettre en majuscule indiquant ".
-
 
2074
								"un code de présence spécifique au référentiel.",
-
 
Line 2075... Line 2047...
2075
			'resultat' => false);
2047
		$info = $this->getInfosTest(62);
2076
		
2048
		
2077
		// Réalisation du test
2049
		// Réalisation du test
2078
		$noms_erreur = array();
2050
		$noms_erreur = array();
Line 2098... Line 2070...
2098
	
2070
	
2099
	/**
2071
	/**
2100
	 * Test #63
2072
	 * Test #63
2101
	 */
2073
	 */
2102
	private function testerStatutIntroductionSyntaxe() {
-
 
2103
		$info = array('nom' => 'statut_introduction -> syntaxe',
-
 
2104
			'description' => "Le champ statut_introduction peut contenir :\n".
-
 
2105
								" - le symbole tiret «-» précédant une autre information non référencée...\n".
-
 
2106
								" - une première lettre en majuscule indiquant le code standard attribué à ce taxon,\n".
-
 
2107
								" - éventuellement suivie d'un tiret puis d'une deuxième lettre en majuscule indiquant ".
-
 
2108
								"un code de présence spécifique au référentiel.",
2074
	private function testerStatutIntroductionSyntaxe() {
Line 2109... Line 2075...
2109
			'resultat' => false);
2075
		$info = $this->getInfosTest(63);
2110
		
2076
		
2111
		// Réalisation du test
2077
		// Réalisation du test
2112
		$noms_erreur = array();
2078
		$noms_erreur = array();
Line 2132... Line 2098...
2132
	
2098
	
2133
	/**
2099
	/**
2134
	 * Test #64
2100
	 * Test #64
2135
	 */
2101
	 */
2136
	private function testerStatutCultureSyntaxe() {
2102
	private function testerStatutCultureSyntaxe() {
2137
		$info = array('nom' => 'statut_culture -> syntaxe',
-
 
2138
			'description' => "Le champ statut_culture peut contenir :\n".
-
 
2139
								" - le symbole tiret «-» précédant une autre information non référencée...\n".
-
 
2140
								" - une première lettre en majuscule indiquant le code standard attribué à ce taxon,\n".
-
 
2141
								" - éventuellement suivie d'un tiret puis d'une deuxième lettre en majuscule indiquant ".
-
 
2142
								"un code de présence spécifique au référentiel.",
-
 
Line 2143... Line 2103...
2143
			'resultat' => false);
2103
		$info = $this->getInfosTest(64);
2144
		
2104
		
2145
		// Réalisation du test
2105
		// Réalisation du test
2146
		$noms_erreur = array();
2106
		$noms_erreur = array();
Line 2167... Line 2127...
2167
	/**
2127
	/**
2168
	 * Test #65
2128
	 * Test #65
2169
	 */
2129
	 */
2170
	private function testerExclureTaxRefSyntaxe() {
2130
	private function testerExclureTaxRefSyntaxe() {
2171
		$info = $this->getInfosTest(65);
2131
		$info = $this->getInfosTest(65);
2172
		$info = array('nom' => 'exclure_taxref -> syntaxe',
-
 
2173
			'description' => "Le champ exclure_taxref contient soit :\n".
-
 
2174
			" - une valeur vide.\n".
-
 
2175
			" - une valeur null.\n".
-
 
2176
			" - le chiffre 0.\n".
-
 
2177
			" - le chiffre 1",
-
 
2178
			'resultat' => false);
-
 
2179
		
2132
	
2180
		// Réalisation du testCe n'est pas programmé.
2133
		// Réalisation du testCe n'est pas programmé.
2181
		$noms_erreur = array();
2134
		$noms_erreur = array();
2182
		foreach ($this->noms as &$nom) {
2135
		foreach ($this->noms as &$nom) {
2183
			if ($nom['exclure_taxref'] != '' && $nom['exclure_taxref'] != null) {
2136
			if ($nom['exclure_taxref'] != '' && $nom['exclure_taxref'] != null) {
2184
				if (!$this->verifierBooleen($nom['exclure_taxref'])) {
2137
				if (!$this->verifierBooleen($nom['exclure_taxref'])) {
Line 2479... Line 2432...
2479
		return $noms_classes;
2432
		return $noms_classes;
2480
	}
2433
	}
Line 2481... Line 2434...
2481
 
2434
 
2482
	private function getInfosTest($numero) {
2435
	private function getInfosTest($numero) {
-
 
2436
		$info = $this->tests[$numero];
2483
		$info = $this->tests[$numero];
2437
		$info['methode'] = 'tester'.implode('', explode(' ', ucwords($info['abr'])));
2484
		$info['numero'] = $numero; 
2438
		$info['numero'] = $numero; 
2485
		$info['resultat'] = false;
2439
		$info['resultat'] = false;
2486
		return $info;
2440
		return $info;
2487
	}
2441
	}