Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 145 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 145 Rev 152
1
<?php
1
<?php
2
include_once dirname(__FILE__).'/../../../bibliotheque/Surligneur.php';
2
include_once dirname(__FILE__).'/../../../bibliotheque/Surligneur.php';
3
include_once dirname(__FILE__).'/../../../bibliotheque/Trieur.php';
3
include_once dirname(__FILE__).'/../../../bibliotheque/Trieur.php';
4
include_once dirname(__FILE__).'/../../../modules/resultat/ParametresResultats.php';
4
include_once dirname(__FILE__).'/../../../modules/resultat/ParametresResultats.php';
5
include_once dirname(__FILE__).'/../../../modules/resultat/Formateur.php';
5
include_once dirname(__FILE__).'/../../../modules/resultat/Formateur.php';
6
include_once dirname(__FILE__).'/../../../bibliotheque/ChaineManipulateur.php';
6
include_once dirname(__FILE__).'/../../../bibliotheque/ChaineManipulateur.php';
7
 
7
 
8
class ResultatFormateurCommun extends PHPUnit_Framework_TestCase {
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';
9
	const TPL_URL_FICHE = 'http://localhost/eflore/eflore-consultation/index_botanique.php?referentiel=bdtfx&module=fiche&action=fiche&nn=%s';
10
 
10
 
11
	protected function getParametres($type, $masque) {
11
	protected function getParametres($type, $masque) {
12
		$parametres = new ParametresResultats();
12
		$parametres = new ParametresResultats();
13
		$parametres->type = $type;
13
		$parametres->type = $type;
14
		$parametres->masqueRecherche = $masque;
14
		$parametres->masqueRecherche = $masque;
15
		return $parametres;
15
		return $parametres;
16
	}
16
	}
17
 
17
 
18
	protected function getResultatsPourMasque($masque) {
18
	protected function getResultatsPourMasque($masque) {
19
		$resultats['viola his'] = array(
-
 
20
				'entete' => array(
-
 
21
					'masque' => 'nom_sci=%viola% his%',
-
 
22
					'depart' => 0,
-
 
23
					'limite' => 3000,
-
 
24
					'total' => 5),
-
 
25
				'resultat' => array(
-
 
26
					'72291' => array(
-
 
27
						'nom_sci' => 'Viola hispida Lapeyr. [1813]',
-
 
28
						'href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72291',
-
 
29
						'retenu' => false,
-
 
30
						'nom_retenu' => 'Viola bubanii Timb.-Lagr. [1852]',
-
 
31
						'nom_retenu.id' => '72117',
-
 
32
						'nom_retenu.href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72117'),
19
		$resultatsJson = file_get_contents(dirname(__FILE__).'/resultats.json');
33
					'72288' => array(
-
 
34
						'nom_sci' => 'Viola hispida Lam. [1779]',
-
 
35
						'href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72288',
-
 
36
						'retenu' => true,
-
 
37
						'nom_retenu' => 'Viola hispida Lam. [1779]',
-
 
38
						'nom_retenu.id' => '72288',
-
 
39
						'nom_retenu.href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72288'),
-
 
40
					'72341' => array(
-
 
41
						'nom_sci' => 'Viola lutea var. hispida Nyman [1878]',
20
		$resultats = json_decode($resultatsJson, true);
42
						'href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72341',
-
 
43
						'retenu' => false,
-
 
44
						'nom_retenu' => 'Viola bubanii Timb.-Lagr. [1852]',
-
 
45
						'nom_retenu.id' => '72117',
-
 
46
						'nom_retenu.href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72117'),
-
 
47
					'72289' => array(
-
 
48
						'nom_sci' => 'Viola hispida subsp. cryana (Gillot) P.Fourn. [1928]',
-
 
49
						'href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72289',
-
 
50
						'retenu' => false,
-
 
51
						'nom_retenu' => 'Viola cryana Gillot [1878]',
-
 
52
						'nom_retenu.id' => '72201',
-
 
53
						'nom_retenu.href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72201'),
-
 
54
					'72290' => array(
-
 
55
						'nom_sci' => 'Viola hispida subsp. rothomagensis P.Fourn. [1928]',
-
 
56
						'href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72290',
-
 
57
						'retenu' => false,
-
 
58
						'nom_retenu' => 'Viola hispida Lam. [1779]',
-
 
59
						'nom_retenu.id' => '72288',
-
 
60
						'nom_retenu.href' => 'http://localhost/service:eflore:0.1/bdtfx/noms/72288')));
-
 
61
		return $resultats[$masque];
21
		return $resultats[$masque];
62
	}
22
	}
63
 
23
 
64
	protected function getSurligneur() {
24
	protected function getSurligneur() {
65
		$surligneur = new Surligneur();
25
		$surligneur = new Surligneur();
66
		return $surligneur;
26
		return $surligneur;
67
	}
27
	}
68
 
28
 
69
	protected function getTrieur() {
29
	protected function getTrieur() {
70
		$trieur = new Trieur();
30
		$trieur = new Trieur();
71
		return $trieur;
31
		return $trieur;
72
	}
32
	}
73
 
33
 
74
	protected function getAppUrls() {
34
	protected function getAppUrls() {
75
		$AppUrls = $this->getMock('AppUrls', array('obtenirUrlFiche'), array(), '', false);
35
		$AppUrls = $this->getMock('AppUrls', array('obtenirUrlFiche'), array(), '', false);
76
		$AppUrls->expects($this->any())
36
		$AppUrls->expects($this->any())
77
		->method('obtenirUrlFiche')
37
		->method('obtenirUrlFiche')
78
		->will($this->returnCallback(array($this, 'genererUrlFiche')));
38
		->will($this->returnCallback(array($this, 'genererUrlFiche')));
79
		return $AppUrls;
39
		return $AppUrls;
80
	}
40
	}
81
 
41
 
82
	public function genererUrlFiche($id) {
42
	public function genererUrlFiche($id) {
83
		return sprintf(self::TPL_URL_FICHE, $id);
43
		return sprintf(self::TPL_URL_FICHE, $id);
84
	}
44
	}
85
}
45
}
86
?>
46
?>