Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 204 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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