Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 186 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
186 delphine 1
<?php
2
require_once dirname(__FILE__).'/../ConsultationEflorePhpUnit.php';
3
 
4
class NiveauTest extends ConsultationEflorePhpUnit {
5
	const TPL_URL_BASE = 'http://localhost/eflore/eflore-consultation/index_botanique.php?referentiel=bdtfx';
6
 
7
	public function testAfficherNiveau() {
8
		$_GET['referentiel'] = 'bdtfx';
9
		$_GET['module'] = 'recherche';
10
		$_GET['action'] = 'rechercheSimple';
11
		$_GET['type_nom'] = 'nom_scientifique';
12
		$_GET['nom'] = 'acer+mons';
13
		Registre::set('parametres.niveau', '2');
14
		$niveau = new Niveau($this->getAppUrls());
15
 
16
		$sortie = $niveau->afficherNiveau();
17
 
18
		$this->assertNotEmpty($sortie, print_r($sortie, true));
19
		$this->assertNotContains(' <input id="niveau_2" name="niveau" value="2" type="radio" checked="checked" />', $sortie);
204 delphine 20
		$this->assertContains('<input id="eflore_niveau_type_nom" name="type_nom" type="hidden" value="nom_scientifique" />', $sortie, print_r($sortie,true));
21
		$this->assertContains('<input id="eflore_niveau_referentiel" name="referentiel" type="hidden" value="bdtfx" />', $sortie);
22
		$this->assertContains('<input id="eflore_niveau_action" name="action" type="hidden" value="rechercheSimple" />', $sortie);
23
		$this->assertContains('<input id="eflore_niveau_nom" name="nom" type="hidden" value="acer+mons" />', $sortie);
186 delphine 24
	}
25
 
26
	protected function getAppUrls() {
27
		$AppUrls = $this->getMock('AppUrls', array('obtenirUrlBase'), array(), '', false);
28
		$AppUrls->expects($this->any())
29
		->method('obtenirUrlBase')
30
		->will($this->returnCallback(array($this, 'genererUrlBase')));
31
		return $AppUrls;
32
	}
33
	public function genererUrlBase($id) {
34
		return sprintf(self::TPL_URL_BASE, $id);
35
	}
36
}
37
?>