139 |
delphine |
1 |
<?php
|
|
|
2 |
require_once dirname(__FILE__).'/../ConsultationEflorePhpUnit.php';
|
|
|
3 |
|
|
|
4 |
class RechercheTest extends ConsultationEflorePhpUnit {
|
|
|
5 |
public function testMoteurRechercheSimple() {
|
|
|
6 |
$moteur = '<!-- DEBUT FORM_NOM -->
|
|
|
7 |
<script type="text/javascript">
|
|
|
8 |
<!--
|
|
|
9 |
var urlServiceAutocompletionNomsSci = "http://localhost/service:eflore:0.1/bdtfx/noms";
|
|
|
10 |
var urlServiceAutocompletionNomsVerna = "";
|
|
|
11 |
var urlBaseFicheTaxon = "http://localhost/opt/lampp/bin/phpunit?referentiel=bdtfx&module=fiche&action=fiche&nn={num_taxon}";
|
|
|
12 |
var valeurDefautNomSci = "Rechercher un nom scientifique";
|
|
|
13 |
var valeurDefautNomVerna = "Rechercher un nom commun";
|
|
|
14 |
// -->
|
|
|
15 |
</script>
|
|
|
16 |
<form id="ef-form-nomenclature" name="ef-form-nomenclature" action="http://localhost/opt/lampp/bin/phpunit?referentiel=bdtfx&module=fiche&action=fiche&nn={num_taxon}" method="get" class="importance1">
|
|
|
17 |
<fieldset>
|
|
|
18 |
<h1>Rechercher une plante</h1>
|
|
|
19 |
<span class="zone-choix-type-nom">
|
|
|
20 |
<input id="type-nom-scientifique" name="type_nom" type="hidden" value="nom_scientifique" />
|
|
|
21 |
Nom scientifique </span>
|
|
|
22 |
<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" />
|
|
|
23 |
<span id="zone-liens-recherche">
|
|
|
24 |
<input id="referentiel" name="referentiel" type="hidden" value="bdtfx" />
|
|
|
25 |
<input id="module" name="module" type="hidden" value="recherche" />
|
|
|
26 |
<input id="action" name="action" type="hidden" value="rechercheSimple" />
|
|
|
27 |
<input id="eflore_nomenclature_submit" name="submit" type="submit" value="OK" class="ok"/>
|
|
|
28 |
<input id="eflore_nomenclature_fiche" name="submit" type="submit" value="Accès fiche" />
|
|
|
29 |
</span>
|
|
|
30 |
</fieldset>
|
|
|
31 |
</form>
|
|
|
32 |
<!-- FIN FORM_NOM -->';
|
|
|
33 |
|
|
|
34 |
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
|
|
|
35 |
Config::charger($cheminRacine.'bdtfx.ini');
|
|
|
36 |
Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
|
|
|
37 |
Registre::set('parametres.referentiel', 'bdtfx');
|
|
|
38 |
|
|
|
39 |
$recherche = new RechercheSimple();
|
|
|
40 |
$recherche->executerAccueil();
|
|
|
41 |
$sortie = implode('', $recherche->getSortie());
|
|
|
42 |
|
|
|
43 |
$this->assertNotEmpty($sortie, print_r($sortie, true));
|
|
|
44 |
$this->assertContains('<input id="type-nom-scientifique" name="type_nom" type="hidden" value="nom_scientifique" />', $sortie, print_r($sortie,true));
|
|
|
45 |
$this->assertContains('<input id="referentiel" name="referentiel" type="hidden" value="bdtfx" />', $sortie);
|
|
|
46 |
$this->assertContains('<input id="action" name="action" type="hidden" value="rechercheSimple" />', $sortie);
|
|
|
47 |
$this->assertNotContains('<input id="type_nom_vernaculaire" name="type_nom" value="nom_vernaculaire" type="radio" checked="checked" />', $sortie);
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
public function testMoteurRechercheSimpleForm() {
|
|
|
51 |
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
|
|
|
52 |
Config::charger($cheminRacine.'bdtfx.ini');
|
|
|
53 |
Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
|
|
|
54 |
Registre::set('parametres.referentiel', 'bdtfx');
|
|
|
55 |
$donnees['type_nom'] = 'nom_vernaculaire';
|
|
|
56 |
$donnees['nom'] = 'acer';
|
|
|
57 |
$donnees['nom_verna'] = 'true';
|
|
|
58 |
Registre::set('donneesMoteur', $donnees);
|
|
|
59 |
|
|
|
60 |
$recherche = new RechercheSimple();
|
|
|
61 |
$recherche->executerForm();
|
|
|
62 |
$sortie = implode('', $recherche->getSortie());
|
|
|
63 |
Registre::detruire('donneesMoteur');
|
|
|
64 |
|
|
|
65 |
$this->assertNotEmpty($sortie, print_r($sortie, true));
|
|
|
66 |
$this->assertNotContains('<input id="type-nom-scientifique" name="type_nom" type="hidden" value="nom_scientifique" />', $sortie);
|
|
|
67 |
$this->assertContains('<input id="referentiel" name="referentiel" type="hidden" value="bdtfx" />', $sortie);
|
|
|
68 |
$this->assertContains('<input id="action" name="action" type="hidden" value="rechercheSimple" />', $sortie);
|
|
|
69 |
$this->assertContains('<input id="type_nom_vernaculaire" name="type_nom" value="nom_vernaculaire" type="radio" checked="checked" />', $sortie);
|
|
|
70 |
$this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer" />', $sortie);
|
|
|
71 |
|
|
|
72 |
}
|
|
|
73 |
}
|
|
|
74 |
?>
|