Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 164 → Rev 165

/trunk/tests/metier/NomsTest.php
11,8 → 11,46
$resultats = $noms->getRechercheEtendue('aceras');
$this->assertNotEmpty($resultats);
$this->assertEquals('15', $resultats['entete']['total']);
$this->assertNotEmpty($resultats['resultat']['243']);
$this->assertEquals('Aceras hircina', $resultats['resultat']['243']['nom_sci']);
$this->assertArrayNotHasKey('nom_retenu.id', $resultats['resultat']['243']);
$this->assertArrayNotHasKey('auteur', $resultats['resultat']['243']);
$this->assertArrayNotHasKey('annee', $resultats['resultat']['243']);
$this->assertArrayNotHasKey('biblio_origine', $resultats['resultat']['243']);
}
public function testRechercheEtendueDetermination() {
Registre::set('parametres.referentiel', 'bdtfx');
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
Config::charger($cheminRacine.'config.ini');
$noms = new Noms();
$resultats = $noms->getRechercheEtendue('aceras', 'determination');
$this->assertNotEmpty($resultats);
$this->assertEquals('15', $resultats['entete']['total']);
$this->assertNotEmpty($resultats['resultat']['243']);
$this->assertEquals('Aceras hircina', $resultats['resultat']['243']['nom_sci']);
$this->assertEquals('32023', $resultats['resultat']['243']['nom_retenu.id']);
$this->assertArrayNotHasKey('auteur', $resultats['resultat']['243']);
$this->assertArrayNotHasKey('annee', $resultats['resultat']['243']);
$this->assertArrayNotHasKey('biblio_origine', $resultats['resultat']['243']);
}
public function testRechercheEtendueDecompo() {
Registre::set('parametres.referentiel', 'bdtfx');
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
Config::charger($cheminRacine.'config.ini');
$noms = new Noms();
$resultats = $noms->getRechercheEtendue('aceras', 'decompo');
$this->assertNotEmpty($resultats);
$this->assertEquals('15', $resultats['entete']['total']);
$this->assertNotEmpty($resultats['resultat']['243']);
$this->assertEquals('Aceras hircina', $resultats['resultat']['243']['nom_sci']);
$this->assertArrayNotHasKey('nom_retenu.id', $resultats['resultat']['243']);
$this->assertArrayHasKey('auteur', $resultats['resultat']['243']);
$this->assertArrayHasKey('annee', $resultats['resultat']['243']);
$this->assertArrayHasKey('biblio_origine', $resultats['resultat']['243']);
}
public function testRechercheFloue() {
Registre::set('parametres.referentiel', 'bdtfx');
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
/trunk/tests/metier/NomsVernaculairesTest.php
13,6 → 13,16
$this->assertEquals('3', $resultats['entete']['total']);
}
public function testRechercheEtendueDetermination() {
Registre::set('parametres.referentiel', 'nvjfl');
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
Config::charger($cheminRacine.'config.ini');
$noms = new NomsVernaculaires();
$resultats = $noms->getRechercheEtendue('abricotier', 'determination');
$this->assertNotEmpty($resultats);
$this->assertEquals('3', $resultats['entete']['total']);
}
public function testRechercheFloue() {
Registre::set('parametres.referentiel', 'nvjfl');
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
/trunk/tests/modules/RechercheTest.php
6,6 → 6,7
public function testExecuterRechercheSimple() {
$_GET['type_nom'] = 'nom_scientifique';
$_GET['nom'] = 'acer mons';
Registre::set('niveau', '1');
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
Config::charger($cheminRacine.'bdtfx.ini');
Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
22,10 → 23,35
$this->assertNotEmpty($resultat, print_r($resultat, true));
$this->assertEquals('6', $resultat['entete']['total']);
$this->assertEquals('6', count($resultat['resultat']));
$this->assertArrayHasNotKey('auteur', $resultat['resultat']['182']);
$this->assertNotEmpty($sortie, print_r($sortie, true));
$this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer mons" />', $sortie);
$this->assertContains('<strong class="nom-sci-retenu"><span class="surlignage">Acer</span> <span class="surlignage">mons</span>pessullanum</strong>', $sortie);
 
}
public function testExecuterRechercheSimpleResDecompo() {
$_GET['type_nom'] = 'nom_scientifique';
$_GET['nom'] = 'acer mons';
$_GET['resultat'] = 'decompo';
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
Config::charger($cheminRacine.'bdtfx.ini');
Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));
Registre::set('parametres.referentiel', 'bdtfx');
$recherche = new Recherche();
$recherche->initialiser();
$recherche->executerRechercheSimple();
$donnees = Registre::get('donneesMoteur');
$resultat = Registre::get('resultats');
$sortie = implode('', $recherche->getSortie());
$this->assertEmpty($donnees, print_r($donnees, true));
$this->assertNotEmpty($resultat, print_r($resultat, true));
$this->assertEquals('6', $resultat['entete']['total']);
$this->assertEquals('6', count($resultat['resultat']));
$this->assertArrayHasKey('auteur', $resultat['resultat']['182']);
$this->assertNotEmpty($sortie, print_r($sortie, true));
$this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer mons" />', $sortie);
}
}
?>
/trunk/tests/modules/RechercheSimpleTest.php
3,34 → 3,6
 
class RechercheSimpleTest extends ConsultationEflorePhpUnit {
public function testMoteurRechercheSimple() {
$moteur = '<!-- DEBUT FORM_NOM -->
<script type="text/javascript">
<!--
var urlServiceAutocompletionNomsSci = "http://localhost/service:eflore:0.1/bdtfx/noms";
var urlServiceAutocompletionNomsVerna = "";
var urlBaseFicheTaxon = "http://localhost/opt/lampp/bin/phpunit?referentiel=bdtfx&module=fiche&action=fiche&nn={num_taxon}";
var valeurDefautNomSci = "Rechercher un nom scientifique";
var valeurDefautNomVerna = "Rechercher un nom commun";
// -->
</script>
<form id="ef-form-nomenclature" name="ef-form-nomenclature" action="http://localhost/opt/lampp/bin/phpunit?referentiel=bdtfx&amp;module=fiche&amp;action=fiche&amp;nn={num_taxon}" method="get" class="importance1">
<fieldset>
<h1>Rechercher une plante</h1>
<span class="zone-choix-type-nom">
<input id="type-nom-scientifique" name="type_nom" type="hidden" value="nom_scientifique" />
Nom scientifique </span>
<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" />
<span id="zone-liens-recherche">
<input id="referentiel" name="referentiel" type="hidden" value="bdtfx" />
<input id="module" name="module" type="hidden" value="recherche" />
<input id="action" name="action" type="hidden" value="rechercheSimple" />
<input id="eflore_nomenclature_submit" name="submit" type="submit" value="OK" class="ok"/>
<input id="eflore_nomenclature_fiche" name="submit" type="submit" value="Accès fiche" />
</span>
</fieldset>
</form>
<!-- FIN FORM_NOM -->';
 
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/';
Config::charger($cheminRacine.'bdtfx.ini');
Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index')));