Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 139 | Rev 167 | Go to most recent revision | Details | Compare with Previous | 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';
165 delphine 9
		Registre::set('niveau', '1');
139 delphine 10
		$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
11
		Config::charger($cheminRacine.'bdtfx.ini');
12
		Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
13
		Registre::set('parametres.referentiel', 'bdtfx');
14
 
15
		$recherche = new Recherche();
16
		$recherche->initialiser();
17
		$recherche->executerRechercheSimple();
18
 
19
		$donnees = Registre::get('donneesMoteur');
20
		$resultat = Registre::get('resultats');
21
		$sortie = implode('', $recherche->getSortie());
22
		$this->assertEmpty($donnees, print_r($donnees, true));
23
		$this->assertNotEmpty($resultat, print_r($resultat, true));
24
		$this->assertEquals('6', $resultat['entete']['total']);
25
		$this->assertEquals('6', count($resultat['resultat']));
165 delphine 26
		$this->assertArrayHasNotKey('auteur', $resultat['resultat']['182']);
139 delphine 27
		$this->assertNotEmpty($sortie, print_r($sortie, true));
28
		$this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer mons" />', $sortie);
29
		$this->assertContains('<strong class="nom-sci-retenu"><span class="surlignage">Acer</span> <span class="surlignage">mons</span>pessullanum</strong>', $sortie);
30
	}
165 delphine 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);
55
	}
139 delphine 56
}
57
?>