Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 152 | Go to most recent revision | Details | 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) {
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'),
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]',
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];
62
	}
63
 
64
	protected function getSurligneur() {
65
		$surligneur = new Surligneur();
66
		return $surligneur;
67
	}
68
 
69
	protected function getTrieur() {
70
		$trieur = new Trieur();
71
		return $trieur;
72
	}
73
 
74
	protected function getAppUrls() {
75
		$AppUrls = $this->getMock('AppUrls', array('obtenirUrlFiche'), array(), '', false);
76
		$AppUrls->expects($this->any())
77
		->method('obtenirUrlFiche')
78
		->will($this->returnCallback(array($this, 'genererUrlFiche')));
79
		return $AppUrls;
80
	}
81
 
82
	public function genererUrlFiche($id) {
83
		return sprintf(self::TPL_URL_FICHE, $id);
84
	}
85
}
86
?>