Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 139 Rev 165
Line 4... Line 4...
4
class RechercheTest extends ConsultationEflorePhpUnit {
4
class RechercheTest extends ConsultationEflorePhpUnit {
Line 5... Line 5...
5
 
5
 
6
	public function testExecuterRechercheSimple() {
6
	public function testExecuterRechercheSimple() {
7
		$_GET['type_nom'] = 'nom_scientifique';
7
		$_GET['type_nom'] = 'nom_scientifique';
-
 
8
		$_GET['nom'] = 'acer mons';
8
		$_GET['nom'] = 'acer mons';
9
		Registre::set('niveau', '1');
9
		$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
10
		$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
10
		Config::charger($cheminRacine.'bdtfx.ini');
11
		Config::charger($cheminRacine.'bdtfx.ini');
11
		Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
12
		Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
Line 20... Line 21...
20
		$sortie = implode('', $recherche->getSortie());
21
		$sortie = implode('', $recherche->getSortie());
21
		$this->assertEmpty($donnees, print_r($donnees, true));
22
		$this->assertEmpty($donnees, print_r($donnees, true));
22
		$this->assertNotEmpty($resultat, print_r($resultat, true));
23
		$this->assertNotEmpty($resultat, print_r($resultat, true));
23
		$this->assertEquals('6', $resultat['entete']['total']);
24
		$this->assertEquals('6', $resultat['entete']['total']);
24
		$this->assertEquals('6', count($resultat['resultat']));
25
		$this->assertEquals('6', count($resultat['resultat']));
-
 
26
		$this->assertArrayHasNotKey('auteur', $resultat['resultat']['182']);
25
		$this->assertNotEmpty($sortie, print_r($sortie, true));
27
		$this->assertNotEmpty($sortie, print_r($sortie, true));
26
		$this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer mons" />', $sortie);
28
		$this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer mons" />', $sortie);
27
		$this->assertContains('<strong class="nom-sci-retenu"><span class="surlignage">Acer</span> <span class="surlignage">mons</span>pessullanum</strong>', $sortie);
29
		$this->assertContains('<strong class="nom-sci-retenu"><span class="surlignage">Acer</span> <span class="surlignage">mons</span>pessullanum</strong>', $sortie);
-
 
30
	}
28
 
31
	
-
 
32
	public function testExecuterRechercheSimpleResDecompo() {
-
 
33
		$_GET['type_nom'] = 'nom_scientifique';
-
 
34
		$_GET['nom'] = 'acer mons';
-
 
35
		$_GET['resultat'] = 'decompo';
-
 
36
		$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
-
 
37
		Config::charger($cheminRacine.'bdtfx.ini');
-
 
38
		Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
-
 
39
		Registre::set('parametres.referentiel', 'bdtfx');
-
 
40
	
-
 
41
		$recherche = new Recherche();
-
 
42
		$recherche->initialiser();
-
 
43
		$recherche->executerRechercheSimple();
-
 
44
	
-
 
45
		$donnees = Registre::get('donneesMoteur');
-
 
46
		$resultat = Registre::get('resultats');
-
 
47
		$sortie = implode('', $recherche->getSortie());
-
 
48
		$this->assertEmpty($donnees, print_r($donnees, true));
-
 
49
		$this->assertNotEmpty($resultat, print_r($resultat, true));
-
 
50
		$this->assertEquals('6', $resultat['entete']['total']);
-
 
51
		$this->assertEquals('6', count($resultat['resultat']));
-
 
52
		$this->assertArrayHasKey('auteur', $resultat['resultat']['182']);
-
 
53
		$this->assertNotEmpty($sortie, print_r($sortie, true));
-
 
54
		$this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer mons" />', $sortie);
29
	}
55
	}
30
}
56
}
31
?>
57
?>
32
58