| Line 96... |
Line 96... |
| 96 |
|
96 |
|
| 97 |
public function testParametreNavigationErrone() {
|
97 |
public function testParametreNavigationErrone() {
|
| 98 |
$ressources = array();
|
98 |
$ressources = array();
|
| 99 |
$parametresList = array(
|
99 |
$parametresList = array(
|
| 100 |
array('navigation.depart' => -5, 'navigation.limite' => 10 ),
|
100 |
array('navigation.depart' => -5, 'navigation.limite' => 10 ),
|
| 101 |
array('navigation.depart' => 0, 'navigation.limite' => abc ));
|
101 |
array('navigation.depart' => 0, 'navigation.limite' => 'abc' ));
|
| 102 |
$cles = array('navigation.depart','navigation.limite');
|
102 |
$cles = array('navigation.depart','navigation.limite');
|
| 103 |
$i = 0 ;
|
103 |
$i = 0 ;
|
| 104 |
foreach ($parametresList as $parametres) {
|
104 |
foreach ($parametresList as $parametres) {
|
| 105 |
$retour = ServiceEflorePhpUnit::consulterBrut($this->service, $this->projet, $ressources, $parametres);
|
105 |
$retour = ServiceEflorePhpUnit::consulterBrut($this->service, $this->projet, $ressources, $parametres);
|
| Line 130... |
Line 130... |
| 130 |
$parametres = array('version.projet' => 'dhgkg22');
|
130 |
$parametres = array('version.projet' => 'dhgkg22');
|
| 131 |
foreach ($ressourcesList as $ressources){
|
131 |
foreach ($ressourcesList as $ressources){
|
| 132 |
$retour = ServiceEflorePhpUnit::consulterBrut($this->service, $this->projet, $ressources, $parametres);
|
132 |
$retour = ServiceEflorePhpUnit::consulterBrut($this->service, $this->projet, $ressources, $parametres);
|
| 133 |
$messageAttendu = "Erreur : La version est inconnue.";
|
133 |
$messageAttendu = "Erreur : La version est inconnue.";
|
| 134 |
$this->assertEquals($messageAttendu, $retour,
|
134 |
$this->assertEquals($messageAttendu, $retour,
|
| 135 |
"Il faut indiquer si la valeur du paramètre version.projet est inconnue.");
|
135 |
"Il faut indiquer si la valeur du paramètre version.projet est inconnue.");
|
| 136 |
}
|
136 |
}
|
| 137 |
}
|
137 |
}
|
| Line 138... |
Line 138... |
| 138 |
|
138 |
|
| Line 145... |
Line 145... |
| 145 |
$parametres = array('navigation.depart' => 10, 'navigation.limite' => 15);
|
145 |
$parametres = array('navigation.depart' => 10, 'navigation.limite' => 15);
|
| 146 |
$url = ServiceEflorePhpUnit::creerUrl($this->service, $ressources, $parametres);
|
146 |
$url = ServiceEflorePhpUnit::creerUrl($this->service, $ressources, $parametres);
|
| 147 |
$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
|
147 |
$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
|
| 148 |
$this->assertArrayHasKey('entete', $retour, "Le json ne contient pas d'attribut : entete. Voir : $url");
|
148 |
$this->assertArrayHasKey('entete', $retour, "Le json ne contient pas d'attribut : entete. Voir : $url");
|
| 149 |
$this->assertArrayHasKey('resultats', $retour, "Le json ne contient pas d'attribut : resultat. Voir : $url");
|
149 |
$this->assertArrayHasKey('resultats', $retour, "Le json ne contient pas d'attribut : resultat. Voir : $url");
|
| 150 |
$this->verifierJsonEnteteBienFormeInformations($retour, $parametres);
|
150 |
$this->verifierJsonEnteteBienFormeInformations($retour, $ressources, $parametres);
|
| 151 |
}
|
151 |
}
|
| Line 152... |
Line 152... |
| 152 |
|
152 |
|
| 153 |
private function verifierJsonEnteteBienFormeInformations($retour, $parametres) {
|
153 |
private function verifierJsonEnteteBienFormeInformations($retour, $ressources, $parametres) {
|
| 154 |
//depart
|
154 |
//depart
|
| 155 |
$this->assertArrayHasKey('depart', $retour['entete'],
|
155 |
$this->assertArrayHasKey('depart', $retour['entete'],
|
| 156 |
"L'en-tête ne contient pas d'attribut : depart ");
|
156 |
"L'en-tête ne contient pas d'attribut : depart ");
|
| 157 |
$this->assertEquals($retour['entete']['depart'], $parametres['navigation.depart'],
|
157 |
$this->assertEquals($retour['entete']['depart'], $parametres['navigation.depart'],
|
| Line 192... |
Line 192... |
| 192 |
}
|
192 |
}
|
| 193 |
}
|
193 |
}
|
| Line 194... |
Line 194... |
| 194 |
|
194 |
|
| 195 |
public function testJsonNombreLimiteDemande() {
|
195 |
public function testJsonNombreLimiteDemande() {
|
| - |
|
196 |
$ressources = array();
|
| 196 |
$ressources = array();
|
197 |
$parametres = array();
|
| 197 |
$parametresList = array('navigation.depart' => 10, 'navigation.limite' => 15 );
|
198 |
$parametresList = array('navigation.depart' => 10, 'navigation.limite' => 15 );
|
| 198 |
$url = ServiceEflorePhpUnit::creerUrl($this->service, $ressources, $parametres);
|
199 |
$url = ServiceEflorePhpUnit::creerUrl($this->service, $ressources, $parametres);
|
| 199 |
$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
|
200 |
$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
|
| 200 |
$this->assertLessThanOrEqual(15, count($retour),
|
201 |
$this->assertLessThanOrEqual(15, count($retour),
|
| Line 243... |
Line 244... |
| 243 |
}
|
244 |
}
|
| 244 |
}
|
245 |
}
|
| Line 245... |
Line 246... |
| 245 |
|
246 |
|
| 246 |
|
- |
|
| 247 |
public function testJsonInformationsNNBasefor_max() {
|
- |
|
| 248 |
$ressources = array('bdtfx.nn:73256');
|
247 |
|
| 249 |
$parametresList = array(
|
- |
|
| 250 |
array('retour.format' => 'max', 'categorie' => 'description'),
|
248 |
public function testJsonInformationsNNBasefor_max() {
|
| - |
|
249 |
$retour = $this->consulterJson($this->service, $this->projet, ['bdtfx.nn:73256'], ['retour.format' => 'max', 'categorie' => 'description']);
|
| 251 |
array('retour.format' => 'max' , 'categorie' => 'ecologie'));
|
250 |
$this->verifierParametresDescription_max($retour);
|
| 252 |
foreach ($parametresList as $parametres) {
|
- |
|
| 253 |
$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
|
- |
|
| 254 |
if ($parametres['categorie'] == 'description') {
|
- |
|
| 255 |
$this->verifierParametresDescription_max($retour);
|
251 |
|
| 256 |
} else {
|
- |
|
| 257 |
$this->verifierParametresEcologie_max($retour, 'baseflor');
|
- |
|
| 258 |
}
|
252 |
$retour = $this->consulterJson($this->service, $this->projet, ['bdtfx.nn:73256'], ['retour.format' => 'max', 'categorie' => 'ecologie']);
|
| Line 259... |
Line 253... |
| 259 |
}
|
253 |
$this->verifierParametresEcologie_max($retour, 'baseflor');
|
| 260 |
}
|
254 |
}
|
| 261 |
|
255 |
|
| Line 270... |
Line 264... |
| 270 |
}
|
264 |
}
|
| 271 |
}
|
265 |
}
|
| Line 272... |
Line 266... |
| 272 |
|
266 |
|
| 273 |
private function verifierParametresDescription_max($retour) {
|
267 |
private function verifierParametresDescription_max($retour) {
|
| 274 |
$this->assertArrayHasKey('type_bio.code',$retour,
|
268 |
$this->assertArrayHasKey('type_bio.code',$retour,
|
| 275 |
"Le champs 'type_bio.code' doit être présent si retour.format=max. ");
|
269 |
"Le champs 'type_bio.code' doit être présent si retour.format=max. ");
|
| 276 |
$this->assertArrayHasKey('type_bio.libelle',$retour,
|
270 |
$this->assertArrayHasKey('type_bio.libelle',$retour,
|
| 277 |
"Le champs 'type_bio.libelle' doit être présent si retour.format=max.");
|
271 |
"Le champs 'type_bio.libelle' doit être présent si retour.format=max.");
|
| 278 |
$this->assertArrayHasKey('type_bio.detail',$retour,
|
272 |
$this->assertArrayHasKey('type_bio.detail',$retour,
|
| 279 |
"Le champs 'type_bio.detail' doit être présent si retour.format=max.");
|
273 |
"Le champs 'type_bio.detail' doit être présent si retour.format=max.");
|
| Line 280... |
Line 274... |
| 280 |
}
|
274 |
}
|
| 281 |
|
275 |
|
| 282 |
private function verifierParametresEcologie_max($retour,$type) {
|
276 |
private function verifierParametresEcologie_max($retour,$type) {
|
| 283 |
$champs = array_keys(config::get('champs_ontologiques'));
|
277 |
$champs = array_keys(config::get('champs_ontologiques'));
|
| 284 |
if ($type == 'baseflor') {
|
278 |
if ($type == 'baseflor') {
|
| 285 |
foreach ($champs as $chps) {
|
279 |
foreach ($champs as $chps) {
|
| 286 |
$this->assertArrayHasKey($chps.'.libelle', $retour,
|
280 |
$this->assertArrayHasKey($chps.'.libelle', $retour,
|
| 287 |
"Le champs '{$chps}.libelle' doit être présent si retour.format=max.");
|
281 |
"Le champs '{$chps}.libelle' doit être présent si retour.format=max.");
|
| 288 |
$this->assertArrayHasKey($chps.'.code', $retour,
|
282 |
$this->assertArrayHasKey($chps.'.code', $retour,
|
| 289 |
"Le champs '{$chps}.code' doit être présent si retour.format=max.");
|
283 |
"Le champs '{$chps}.code' doit être présent si retour.format=max.");
|
| 290 |
$this->assertArrayHasKey($chps.'.href', $retour,
|
284 |
$this->assertArrayHasKey($chps.'.href', $retour,
|
| 291 |
"Le champs '{$chps}.href' doit être présent si retour.format=max.");
|
285 |
"Le champs '{$chps}.href' doit être présent si retour.format=max.");
|
| 292 |
}
|
286 |
}
|
| 293 |
} elseif ($type == 'rangSup') {
|
287 |
} elseif ($type == 'rangSup') {
|
| 294 |
foreach ($champs as $chps) {
|
288 |
foreach ($champs as $chps) {
|
| 295 |
$this->assertArrayHasKey($chps.'_min.libelle', $retour,
|
289 |
$this->assertArrayHasKey($chps.'_min.libelle', $retour,
|
| 296 |
"Le champs '{$chps}_min.libelle' doit être présent si retour.format=max.");
|
290 |
"Le champs '{$chps}_min.libelle' doit être présent si retour.format=max.");
|
| 297 |
$this->assertArrayHasKey($chps.'_min.code', $retour,
|
291 |
$this->assertArrayHasKey($chps.'_min.code', $retour,
|
| 298 |
"Le champs '{$chps}_min.code' doit être présent si retour.format=max.");
|
292 |
"Le champs '{$chps}_min.code' doit être présent si retour.format=max.");
|
| 299 |
$this->assertArrayHasKey($chps.'_min.href', $retour,
|
293 |
$this->assertArrayHasKey($chps.'_min.href', $retour,
|
| 300 |
"Le champs '{$chps}_min.href' doit être présent si retour.format=max.");
|
294 |
"Le champs '{$chps}_min.href' doit être présent si retour.format=max.");
|
| 301 |
$this->assertArrayHasKey($chps.'_max.libelle', $retour,
|
295 |
$this->assertArrayHasKey($chps.'_max.libelle', $retour,
|
| 302 |
"Le champs '{$chps}_max.libelle' doit être présent si retour.format=max.");
|
296 |
"Le champs '{$chps}_max.libelle' doit être présent si retour.format=max.");
|
| 303 |
$this->assertArrayHasKey($chps.'_max.code', $retour,
|
297 |
$this->assertArrayHasKey($chps.'_max.code', $retour,
|
| 304 |
"Le champs '{$chps}_max.code' doit être présent si retour.format=max.");
|
298 |
"Le champs '{$chps}_max.code' doit être présent si retour.format=max.");
|
| 305 |
$this->assertArrayHasKey($chps.'_max.href', $retour,
|
299 |
$this->assertArrayHasKey($chps.'_max.href', $retour,
|
| 306 |
"Le champs '{$chps}_max.href' doit être présent si retour.format=max.");
|
300 |
"Le champs '{$chps}_max.href' doit être présent si retour.format=max.");
|
| 307 |
}
|
301 |
}
|
| Line 308... |
Line 302... |
| 308 |
}
|
302 |
}
|
| Line 309... |
Line 303... |
| 309 |
}
|
303 |
}
|
| 310 |
|
304 |
|
| 311 |
//++ ------------------------------------Test du champs type biologique -----------------------------++
|
305 |
//++ ------------------------------------Test du champs type biologique -----------------------------++
|
| 312 |
|
306 |
|
| 313 |
//TEST sur différents cas typique de 'type_bio.libelle'
|
307 |
//TEST sur différents cas typique de 'type_bio.libelle'
|
| 314 |
public function testJsonTypeBioOntologies() {
|
308 |
public function testJsonTypeBioOntologies() {
|
| 315 |
$ressourcesList = array(array("bdtfx.nn:73256"),array("bdtfx.nn:70441"),array("bdtfx.nn:62911"),array("bdtfx.nn:72496"),
|
309 |
$ressourcesList = array(array("bdtfx.nn:73256"),array("bdtfx.nn:70441"),array("bdtfx.nn:62911"),array("bdtfx.nn:72496"),
|
| 316 |
array("bdtfx.nn:6446"),array("bdtfx.nn:8373"), array("bdafx.nn:35574"), array("bdtfx.nn:62443"),
|
310 |
array("bdtfx.nn:6446"),array("bdtfx.nn:8373"), array("bdafx.nn:35574"), array("bdtfx.nn:62443"),
|
| 317 |
array("bdtfx.nn:62442"));
|
311 |
array("bdtfx.nn:62442"));
|
| 318 |
$parametres = array();
|
312 |
$parametres = array();
|
| 319 |
$resultats_attendus = array ('Grhi-aqua' => 'Géophytes (>= 1m) à rhizome (plantes aquatiques) ' ,
|
313 |
$resultats_attendus = array ('Grhi-aqua' => 'Géophytes (>= 1m) à rhizome (plantes aquatiques) ' ,
|
| 320 |
'test-aqua-car' => 'Thérophytes (< 1m) estivaux (plantes aquatiques, carnivores) ',
|
314 |
'test-aqua-car' => 'Thérophytes (< 1m) estivaux (plantes aquatiques, carnivores) ',
|
| 321 |
'grhi' => 'Géophytes (< 1m) à rhizome ',
|
315 |
'grhi' => 'Géophytes (< 1m) à rhizome ',
|
| 322 |
'hsto(test)' => 'Hémicryptophytes (< 1m) stolonifères , Thérophytes (< 1m) estivaux ',
|
316 |
'hsto(test)' => 'Hémicryptophytes (< 1m) stolonifères , Thérophytes (< 1m) estivaux ',
|
| 323 |
'Hsto-lia(Grhi-lia)' => 'Hémicryptophytes (>= 1m) stolonifères (lianes) , Géophytes (>= 1m) à rhizome (lianes) ',
|
317 |
'Hsto-lia(Grhi-lia)' => 'Hémicryptophytes (>= 1m) stolonifères (lianes) , Géophytes (>= 1m) à rhizome (lianes) ',
|
| 324 |
'Cfru(b-cad)' => 'Chaméphytes (>= 1m) frutescents , Nanophanérophytes (2 à 4m) (caducifoliées) ',
|
318 |
'Cfru(b-cad)' => 'Chaméphytes (>= 1m) frutescents , Nanophanérophytes (2 à 4m) (caducifoliées) ',
|
| 325 |
'test-aqua(heri)' => 'Thérophytes (< 1m) estivaux (plantes aquatiques) , Hémicryptophytes (< 1m) érigé ',
|
319 |
'test-aqua(heri)' => 'Thérophytes (< 1m) estivaux (plantes aquatiques) , Hémicryptophytes (< 1m) érigé ',
|
| 326 |
'hbis(hsto,test)-suc' => 'Hémicryptophytes (< 1m) bisannuels (succulentes) , Hémicryptophytes (< 1m) stolonifères, Thérophytes (< 1m) estivaux ',
|
320 |
'hbis(hsto,test)-suc' => 'Hémicryptophytes (< 1m) bisannuels (succulentes) , Hémicryptophytes (< 1m) stolonifères, Thérophytes (< 1m) estivaux ',
|
| 327 |
'hbis(hsto)-suc' => 'Hémicryptophytes (< 1m) bisannuels (succulentes) , Hémicryptophytes (< 1m) stolonifères ');
|
321 |
'hbis(hsto)-suc' => 'Hémicryptophytes (< 1m) bisannuels (succulentes) , Hémicryptophytes (< 1m) stolonifères ');
|
| 328 |
foreach ($ressourcesList as $ressources) {
|
322 |
foreach ($ressourcesList as $ressources) {
|
| 329 |
$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
|
323 |
$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
|
| 330 |
$code = $retour['type_bio.code'];
|
324 |
$code = $retour['type_bio.code'];
|
| Line 331... |
Line 325... |
| 331 |
$this->assertEquals($resultats_attendus[$code], $retour['type_bio.libelle'],
|
325 |
$this->assertEquals($resultats_attendus[$code], $retour['type_bio.libelle'],
|
| 332 |
"le traitement de l'ontologie pour les types biologiques est erroné pour $ressources[0] . ");
|
326 |
"le traitement de l'ontologie pour les types biologiques est erroné pour $ressources[0] . ");
|
| - |
|
327 |
}
|
| 333 |
}
|
328 |
}
|
| Line 334... |
Line 329... |
| 334 |
}
|
329 |
|
| 335 |
|
330 |
public function testRelationsCatminat() {
|
| 336 |
public function testRelationsCatminat() {
|
331 |
$ressources = array('bdtfx.nn:5641', 'relations', 'catminat');
|