Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 129 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
50 jpm 1
<?php
2
class GenerateurNomSciHtmlTest extends PHPUnit_Framework_TestCase {
3
 
4
	public static function setUpBeforeClass() {
5
		error_reporting(E_ALL);
6
		define('DS', DIRECTORY_SEPARATOR);
60 jpm 7
		require_once dirname(__FILE__).DS.'..'.DS.'..'.DS.'bibliotheque'.DS.'GenerateurNomSciHtml.php';
50 jpm 8
	}
9
 
10
	public function testGenerer() {
11
		$nomsDecomposes[] = array(
12
			'num_nom' => 1009,
13
			'rang' => 340,
14
			'nom_supra_generique' => '',
15
			'genre' => 'Aegilops',
16
			'epithete_infra_generique' => '',
17
			'epithete_sp' => 'triuncialis',
18
            'type_epithete' => 'var.',
19
            'epithete_infra_sp' => 'nigroferruginea',
20
            'cultivar_groupe' => '',
21
            'nom_commercial' => '',
129 jpm 22
            'cultivar' => '',
23
			'annee' => '1923',
24
			'auteur' => 'Popova',
25
			'biblio_origine' => 'Trudy Prikl. Bot. Selekc., 13 : 476');
50 jpm 26
		$generateur = new GenerateurNomSciHtml();
27
		$nomsSciHtml = $generateur->generer($nomsDecomposes);
28
		$nomSciHtmlGenere = $nomsSciHtml[1009];
129 jpm 29
		$nomSciHtmlAttendu = '<span class="sci"><span class="gen">Aegilops</span> <span class="sp">triuncialis</span> <abbr class="type_epithete" title="Variété">var.</abbr> <span class="infra-sp">nigroferruginea</span></span>';
50 jpm 30
		$this->assertEquals($nomSciHtmlAttendu, $nomSciHtmlGenere);
31
	}
129 jpm 32
 
33
	public function testGenererHybride() {
34
		$nomsDecomposes[] = array(
35
			'num_nom' => 179,
36
			'rang' => 290,
37
			'nom_supra_generique' => '',
38
			'genre' => 'Acer',
39
			'epithete_infra_generique' => '',
40
			'epithete_sp' => 'x martinii',
41
            'type_epithete' => '',
42
            'epithete_infra_sp' => '',
43
            'cultivar_groupe' => '',
44
            'nom_commercial' => '',
45
            'cultivar' => '',
46
			'annee' => '1852',
47
			'auteur' => 'Jord.',
48
			'biblio_origine' => 'Pugill. Pl. Nov., 52'
49
			);
50
		$generateur = new GenerateurNomSciHtml();
51
		$nomsSciHtml = $generateur->generer($nomsDecomposes);
52
		$nomSciHtmlGenere = $nomsSciHtml[179];
53
		$nomSciHtmlAttendu = '<span class="sci"><span class="gen">Acer</span> <span class="hyb">x <span class="sp">martinii</span></span></span>';
54
		$this->assertEquals($nomSciHtmlAttendu, $nomSciHtmlGenere);
55
	}
56
 
57
	public function testGenererChimere() {
58
 
59
		$nomsDecomposes[] = array(
60
			'num_nom' => 80380,
61
			'rang' => 290,
62
			'nom_supra_generique' => '',
63
			'genre' => '+ Cytisus',
64
			'epithete_infra_generique' => '',
65
			'epithete_sp' => 'adami',
66
            'type_epithete' => '',
67
            'epithete_infra_sp' => '',
68
            'cultivar_groupe' => '',
69
            'nom_commercial' => '',
70
            'cultivar' => '',
71
            'annee' => '1830',
72
			'auteur' => 'Poit.',
73
			'biblio_origine' => 'Ann. Soc. Hort. Paris, 7 : 96'
74
			);
75
		$generateur = new GenerateurNomSciHtml();
76
		$nomsSciHtml = $generateur->generer($nomsDecomposes);
77
		$nomSciHtmlGenere = $nomsSciHtml[80380];
78
		$nomSciHtmlAttendu = '<span class="sci"><span class="chimere">+ <span class="gen">Cytisus</span></span> <span class="sp">adami</span></span>';
79
		$this->assertEquals($nomSciHtmlAttendu, $nomSciHtmlGenere);
80
	}
50 jpm 81
}
82
?>