Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
139 delphine 1
<?php
2
require_once dirname(__FILE__).'/../ConsultationEflorePhpUnit.php';
3
 
4
class RechercheTest extends ConsultationEflorePhpUnit {
5
 
6
	public function testExecuterRechercheSimple() {
7
		$_GET['type_nom'] = 'nom_scientifique';
8
		$_GET['nom'] = 'acer mons';
167 jpm 9
 
165 delphine 10
		Registre::set('niveau', '1');
139 delphine 11
		$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
12
		Config::charger($cheminRacine.'bdtfx.ini');
13
		Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
14
		Registre::set('parametres.referentiel', 'bdtfx');
167 jpm 15
 
139 delphine 16
		$recherche = new Recherche();
17
		$recherche->initialiser();
18
		$recherche->executerRechercheSimple();
167 jpm 19
 
139 delphine 20
		$donnees = Registre::get('donneesMoteur');
21
		$resultat = Registre::get('resultats');
22
		$sortie = implode('', $recherche->getSortie());
23
		$this->assertEmpty($donnees, print_r($donnees, true));
24
		$this->assertNotEmpty($resultat, print_r($resultat, true));
25
		$this->assertEquals('6', $resultat['entete']['total']);
26
		$this->assertEquals('6', count($resultat['resultat']));
167 jpm 27
		$this->assertArrayNotHasKey('auteur', $resultat['resultat']['182'], print_r($resultat, true));
139 delphine 28
		$this->assertNotEmpty($sortie, print_r($sortie, true));
29
		$this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer mons" />', $sortie);
167 jpm 30
		$this->assertContains('<strong class="nom-sci-retenu"><span class="surlignage">Acer</span> <span class="surlignage">mons</span>pessulanum</strong>', $sortie);
139 delphine 31
	}
169 delphine 32
 
33
	public function testExecuterRechercheSimpleAlphab() {
34
		$_GET['type_nom'] = 'nom_scientifique';
35
		$_GET['nom'] = 'acer mons';
36
		$_GET['resultat'] = 'alphab';
37
 
38
		$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
39
		Config::charger($cheminRacine.'bdtfx.ini');
40
		Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
41
		Registre::set('parametres.referentiel', 'bdtfx');
42
 
43
		$recherche = new Recherche();
44
		$recherche->initialiser();
45
		$recherche->executerRechercheSimple();
46
 
47
		$donnees = Registre::get('donneesMoteur');
48
		$resultat = Registre::get('resultats');
49
		$sortie = implode('', $recherche->getSortie());
50
		$this->assertEmpty($donnees, print_r($donnees, true));
51
		$this->assertNotEmpty($resultat, print_r($resultat, true));
52
		$this->assertEquals('6', $resultat['entete']['total']);
53
		$this->assertEquals('6', count($resultat['resultat']));
54
	}
55
 
56
	public function testExecuterRechercheSimpleRetenu() {
57
		$_GET['type_nom'] = 'nom_scientifique';
58
		$_GET['nom'] = 'acer mons';
59
		$_GET['resultat'] = 'retenu';
60
 
61
		$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
62
		Config::charger($cheminRacine.'bdtfx.ini');
63
		Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
64
		Registre::set('parametres.referentiel', 'bdtfx');
65
 
66
		$recherche = new Recherche();
67
		$recherche->initialiser();
68
		$recherche->executerRechercheSimple();
69
 
70
		$donnees = Registre::get('donneesMoteur');
71
		$resultat = Registre::get('resultats');
72
		$sortie = implode('', $recherche->getSortie());
73
		$this->assertEmpty($donnees, print_r($donnees, true));
74
		$this->assertNotEmpty($resultat, print_r($resultat, true));
75
		$this->assertEquals('6', $resultat['entete']['total']);
76
		$this->assertEquals('6', count($resultat['resultat']));
77
	}
78
 
79
	public function testExecuterRechercheSimpleSynonyme() {
80
		$_GET['type_nom'] = 'nom_scientifique';
81
		$_GET['nom'] = 'acer mons';
82
		$_GET['resultat'] = 'retenu';
83
 
84
		$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
85
		Config::charger($cheminRacine.'bdtfx.ini');
86
		Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
87
		Registre::set('parametres.referentiel', 'bdtfx');
88
 
89
		$recherche = new Recherche();
90
		$recherche->initialiser();
91
		$recherche->executerRechercheSimple();
92
 
93
		$donnees = Registre::get('donneesMoteur');
94
		$resultat = Registre::get('resultats');
95
		$sortie = implode('', $recherche->getSortie());
96
		$this->assertEmpty($donnees, print_r($donnees, true));
97
		$this->assertNotEmpty($resultat, print_r($resultat, true));
98
		$this->assertEquals('6', $resultat['entete']['total']);
99
		$this->assertEquals('6', count($resultat['resultat']));
100
	}
101
 
167 jpm 102
 
139 delphine 103
}
104
?>