Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev Author Line No. Line
145 jpm 1
<?php
2
include_once dirname(__FILE__).'/../../../bibliotheque/Surligneur.php';
3
include_once dirname(__FILE__).'/../../../bibliotheque/Trieur.php';
4
include_once dirname(__FILE__).'/../../../modules/resultat/ParametresResultats.php';
5
include_once dirname(__FILE__).'/../../../modules/resultat/Formateur.php';
6
include_once dirname(__FILE__).'/../../../bibliotheque/ChaineManipulateur.php';
7
 
8
class ResultatFormateurCommun extends PHPUnit_Framework_TestCase {
9
	const TPL_URL_FICHE = 'http://localhost/eflore/eflore-consultation/index_botanique.php?referentiel=bdtfx&module=fiche&action=fiche&nn=%s';
10
 
11
	protected function getParametres($type, $masque) {
12
		$parametres = new ParametresResultats();
13
		$parametres->type = $type;
14
		$parametres->masqueRecherche = $masque;
15
		return $parametres;
16
	}
17
 
18
	protected function getResultatsPourMasque($masque) {
152 jpm 19
		$resultatsJson = file_get_contents(dirname(__FILE__).'/resultats.json');
20
		$resultats = json_decode($resultatsJson, true);
145 jpm 21
		return $resultats[$masque];
22
	}
23
 
24
	protected function getSurligneur() {
25
		$surligneur = new Surligneur();
26
		return $surligneur;
27
	}
28
 
29
	protected function getTrieur() {
30
		$trieur = new Trieur();
31
		return $trieur;
32
	}
33
 
34
	protected function getAppUrls() {
35
		$AppUrls = $this->getMock('AppUrls', array('obtenirUrlFiche'), array(), '', false);
36
		$AppUrls->expects($this->any())
37
		->method('obtenirUrlFiche')
38
		->will($this->returnCallback(array($this, 'genererUrlFiche')));
39
		return $AppUrls;
40
	}
41
 
42
	public function genererUrlFiche($id) {
43
		return sprintf(self::TPL_URL_FICHE, $id);
44
	}
45
}
46
?>