Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 204 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 204 Rev 1142
Line 1... Line 1...
1
<?php
1
<?php
2
require_once dirname(__FILE__).'/../ConsultationEflorePhpUnit.php';
2
require_once dirname(__FILE__).'/../ConsultationEflorePhpUnit.php';
Line 3... Line 3...
3
 
3
 
4
class NiveauTest extends ConsultationEflorePhpUnit {
-
 
Line 5... Line 4...
5
	const TPL_URL_BASE = 'http://localhost/eflore/eflore-consultation/index_botanique.php?referentiel=bdtfx';
4
class NiveauTest extends ConsultationEflorePhpUnit {
6
 
5
 
7
	public function testAfficherNiveau() {
6
	public function testAfficherNiveau() {
8
		$_GET['referentiel'] = 'bdtfx';
7
		$_GET['referentiel'] = 'bdtfx';
Line 13... Line 12...
13
		Registre::set('parametres.niveau', '2');
12
		Registre::set('parametres.niveau', '2');
14
		$niveau = new Niveau($this->getAppUrls());
13
		$niveau = new Niveau($this->getAppUrls());
Line 15... Line 14...
15
		
14
		
Line 16... Line 15...
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);
Line 23... Line 22...
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')));
-
 
31
		return $AppUrls;
-
 
32
	}
-
 
33
	public function genererUrlBase($id) {
29
				->will($this->returnValue(ConsultationEflorePhpUnit::TPL_URL_BASE));
34
		return sprintf(self::TPL_URL_BASE, $id);
30
		return $AppUrls;
35
	}
31
	}