Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 185 → Rev 186

/trunk/tests/modules/NiveauTest.php
New file
0,0 → 1,37
<?php
require_once dirname(__FILE__).'/../ConsultationEflorePhpUnit.php';
 
class NiveauTest extends ConsultationEflorePhpUnit {
const TPL_URL_BASE = 'http://localhost/eflore/eflore-consultation/index_botanique.php?referentiel=bdtfx';
 
public function testAfficherNiveau() {
$_GET['referentiel'] = 'bdtfx';
$_GET['module'] = 'recherche';
$_GET['action'] = 'rechercheSimple';
$_GET['type_nom'] = 'nom_scientifique';
$_GET['nom'] = 'acer+mons';
Registre::set('parametres.niveau', '2');
$niveau = new Niveau($this->getAppUrls());
$sortie = $niveau->afficherNiveau();
 
$this->assertNotEmpty($sortie, print_r($sortie, true));
$this->assertNotContains(' <input id="niveau_2" name="niveau" value="2" type="radio" checked="checked" />', $sortie);
$this->assertContains('<input id="type_nom" name="type_nom" type="hidden" value="nom_scientifique" />', $sortie, print_r($sortie,true));
$this->assertContains('<input id="referentiel" name="referentiel" type="hidden" value="bdtfx" />', $sortie);
$this->assertContains('<input id="action" name="action" type="hidden" value="rechercheSimple" />', $sortie);
$this->assertContains('<input id="nom" name="nom" type="hidden" value="acer+mons" />', $sortie);
}
protected function getAppUrls() {
$AppUrls = $this->getMock('AppUrls', array('obtenirUrlBase'), array(), '', false);
$AppUrls->expects($this->any())
->method('obtenirUrlBase')
->will($this->returnCallback(array($this, 'genererUrlBase')));
return $AppUrls;
}
public function genererUrlBase($id) {
return sprintf(self::TPL_URL_BASE, $id);
}
}
?>
/trunk/tests/modules/RechercheSimpleTest.php
9,8 → 9,8
Registre::set('parametres.referentiel', 'bdtfx');
 
$recherche = new RechercheSimple();
$recherche->executerAccueil();
$sortie = implode('', $recherche->getSortie());
$sortie = $recherche->executerFormulaireNom();
 
$this->assertNotEmpty($sortie, print_r($sortie, true));
$this->assertContains('<input id="type-nom-scientifique" name="type_nom" type="hidden" value="nom_scientifique" />', $sortie, print_r($sortie,true));
27,12 → 27,9
$donnees['type_nom'] = 'nom_vernaculaire';
$donnees['nom'] = 'acer';
$donnees['nom_verna'] = 'true';
Registre::set('donneesMoteur', $donnees);
 
$recherche = new RechercheSimple();
$recherche->executerForm();
$sortie = implode('', $recherche->getSortie());
Registre::detruire('donneesMoteur');
$sortie = $recherche->executerFormulaireNom($donnees);
 
$this->assertNotEmpty($sortie, print_r($sortie, true));
$this->assertNotContains('<input id="type-nom-scientifique" name="type_nom" type="hidden" value="nom_scientifique" />', $sortie);