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 |
}
|
167 |
jpm |
32 |
|
165 |
delphine |
33 |
public function testExecuterRechercheSimpleResDecompo() {
|
|
|
34 |
$_GET['type_nom'] = 'nom_scientifique';
|
|
|
35 |
$_GET['nom'] = 'acer mons';
|
|
|
36 |
$_GET['resultat'] = 'decompo';
|
|
|
37 |
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
|
|
|
38 |
Config::charger($cheminRacine.'bdtfx.ini');
|
|
|
39 |
Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
|
|
|
40 |
Registre::set('parametres.referentiel', 'bdtfx');
|
167 |
jpm |
41 |
|
165 |
delphine |
42 |
$recherche = new Recherche();
|
|
|
43 |
$recherche->initialiser();
|
|
|
44 |
$recherche->executerRechercheSimple();
|
167 |
jpm |
45 |
|
165 |
delphine |
46 |
$donnees = Registre::get('donneesMoteur');
|
|
|
47 |
$resultat = Registre::get('resultats');
|
|
|
48 |
$sortie = implode('', $recherche->getSortie());
|
|
|
49 |
$this->assertEmpty($donnees, print_r($donnees, true));
|
|
|
50 |
$this->assertNotEmpty($resultat, print_r($resultat, true));
|
|
|
51 |
$this->assertEquals('6', $resultat['entete']['total']);
|
|
|
52 |
$this->assertEquals('6', count($resultat['resultat']));
|
|
|
53 |
$this->assertArrayHasKey('auteur', $resultat['resultat']['182']);
|
|
|
54 |
$this->assertNotEmpty($sortie, print_r($sortie, true));
|
|
|
55 |
$this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer mons" />', $sortie);
|
|
|
56 |
}
|
139 |
delphine |
57 |
}
|
|
|
58 |
?>
|