Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 195 | Rev 790 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 195 Rev 358
Line 181... Line 181...
181
		$message = "L'attribut 'masque' de l'entête devrait valoir '$masque'. Voir : $url";
181
		$message = "L'attribut 'masque' de l'entête devrait valoir '$masque'. Voir : $url";
182
		$this->assertEquals($masque, $retour['entete']['masque'], $message);
182
		$this->assertEquals($masque, $retour['entete']['masque'], $message);
183
		$this->assertEquals('1', $retour['entete']['total'], "L'attribut 'total' de l'entête devrait valoir 1. Voir : $url");
183
		$this->assertEquals('1', $retour['entete']['total'], "L'attribut 'total' de l'entête devrait valoir 1. Voir : $url");
Line 184... Line 184...
184
 
184
 
185
		$this->assertArrayHasKey('resultat', $retour, "Le json ne contient pas d'attribut : resultat. Voir : $url");
185
		$this->assertArrayHasKey('resultat', $retour, "Le json ne contient pas d'attribut : resultat. Voir : $url");
186
		$this->assertEquals('Acer monspessulanum L. [1753, Sp. Pl., éd. 1 : 1056]', $retour['resultat']['182']['nom_sci'], "Le tableau du résultat 182 doit contenir un champ 'nom_sci' avec pour valeur 'Acer monspessulanum'. Voir : $url");
186
		$this->assertEquals('Acer monspessulanum L. [1753, Sp. Pl., éd. 1 : 1056]', $retour['resultat']['182']['nom_sci_complet'], "Le tableau du résultat 182 doit contenir un champ 'nom_sci' avec pour valeur 'Acer monspessulanum'. Voir : $url");
Line 187... Line 187...
187
	}
187
	}
188
 
188
 
189
	public function testNsStructureHtml() {
189
	public function testNsStructureHtml() {
Line 204... Line 204...
204
		$this->assertEquals('1', $retour['entete']['total'], "L'attribut 'total' de l'entête devrait valoir 1. Voir : $url");
204
		$this->assertEquals('1', $retour['entete']['total'], "L'attribut 'total' de l'entête devrait valoir 1. Voir : $url");
Line 205... Line 205...
205
 
205
 
206
		$this->assertArrayHasKey('resultat', $retour, "Le json ne contient pas d'attribut : resultat.\nVoir : $url");
206
		$this->assertArrayHasKey('resultat', $retour, "Le json ne contient pas d'attribut : resultat.\nVoir : $url");
207
		$attendu = '<span class="sci"><span class="gen">Acer</span> <span class="sp">monspessulanum</span></span> <span class="auteur">L.</span> [<span class="annee">1753</span>, <span class="biblio">Sp. Pl., éd. 1 : 1056</span>]';
207
		$attendu = '<span class="sci"><span class="gen">Acer</span> <span class="sp">monspessulanum</span></span> <span class="auteur">L.</span> [<span class="annee">1753</span>, <span class="biblio">Sp. Pl., éd. 1 : 1056</span>]';
208
		$message = "Le tableau du résultat 182 doit contenir un champ 'nom_sci' avec pour valeur '$attendu'. Voir : $url";
208
		$message = "Le tableau du résultat 182 doit contenir un champ 'nom_sci' avec pour valeur '$attendu'. Voir : $url";
209
		$this->assertEquals($attendu, $retour['resultat']['182']['nom_sci'], $message);
209
		$this->assertEquals($attendu, $retour['resultat']['182']['nom_sci_complet'], $message);
Line 210... Line 210...
210
	}
210
	}
211
 
211
 
212
	public function testListeNomsAvecParametreRetourChamps() {
212
	public function testListeNomsAvecParametreRetourChamps() {
Line 243... Line 243...
243
		$retour = $this->consulterJson($ressources, $parametres);
243
		$retour = $this->consulterJson($ressources, $parametres);
244
		$this->assertArrayHasKey('resultat', $retour);
244
		$this->assertArrayHasKey('resultat', $retour);
245
		$this->assertArrayHasKey('39607', $retour['resultat']);
245
		$this->assertArrayHasKey('39607', $retour['resultat']);
246
		$this->assertArrayHasKey('nom_sci', $retour['resultat']['39607']);
246
		$this->assertArrayHasKey('nom_sci', $retour['resultat']['39607']);
247
		$nomSciTxt = 'Lolium annuum Gilib. [1792, Exercit. Phytol., 2 : 520] [nom. invalid.]';
247
		$nomSciTxt = 'Lolium annuum Gilib. [1792, Exercit. Phytol., 2 : 520] [nom. invalid.]';
248
		$this->assertEquals($nomSciTxt, $retour['resultat']['39607']['nom_sci']);
248
		$this->assertEquals($nomSciTxt, $retour['resultat']['39607']['nom_sci_complet']);
249
	}
249
	}
Line 250... Line 250...
250
 
250
 
251
	public function testListeNomAvecParametreNsStructureAuAnBibAdEtNsFormatHtm() {
251
	public function testListeNomAvecParametreNsStructureAuAnBibAdEtNsFormatHtm() {
252
		$ressources = array();
252
		$ressources = array();
Line 262... Line 262...
262
 
262
 
263
		$this->assertArrayHasKey('resultat', $retour);
263
		$this->assertArrayHasKey('resultat', $retour);
264
		$this->assertArrayHasKey('39607', $retour['resultat']);
264
		$this->assertArrayHasKey('39607', $retour['resultat']);
265
		$this->assertArrayHasKey('nom_sci', $retour['resultat']['39607']);
265
		$this->assertArrayHasKey('nom_sci', $retour['resultat']['39607']);
266
		$nomSciHtml = "<span class=\"sci\"><span class=\"gen\">Lolium</span> <span class=\"sp\">annuum</span></span> <span class=\"auteur\">Gilib.</span> [<span class=\"annee\">1792</span>, <span class=\"biblio\">Exercit. Phytol., 2 : 520</span>] [<span class=\"adendum\">nom. invalid.</span>]";
266
		$nomSciHtml = "<span class=\"sci\"><span class=\"gen\">Lolium</span> <span class=\"sp\">annuum</span></span> <span class=\"auteur\">Gilib.</span> [<span class=\"annee\">1792</span>, <span class=\"biblio\">Exercit. Phytol., 2 : 520</span>] [<span class=\"adendum\">nom. invalid.</span>]";
-
 
267
		$this->assertEquals($nomSciHtml, $retour['resultat']['39607']['nom_sci_complet']);
-
 
268
	}
-
 
269
	
-
 
270
	public function testListeNomAvecParametreRetourChamps() {
-
 
271
		$ressources = array();
-
 
272
		$parametres = array('version.projet' => '1.01',
-
 
273
				'masque.nn' => '39607',
-
 
274
				'retour.champs' => 'rang,auteur');
-
 
275
	
-
 
276
		$retour = $this->consulterJson($ressources, $parametres);
-
 
277
		$this->assertArrayHasKey('entete', $retour);
-
 
278
		$this->assertArrayHasKey('masque', $retour['entete']);
-
 
279
		$this->assertEquals('num_nom=39607', $retour['entete']['masque']);
-
 
280
	
-
 
281
		$this->assertArrayHasKey('resultat', $retour);
-
 
282
		$this->assertArrayHasKey('39607', $retour['resultat']);
-
 
283
		$this->assertArrayHasKey('rang.libelle', $retour['resultat']['39607']);
-
 
284
		$this->assertEquals('Espèce', $retour['resultat']['39607']['rang.libelle']);
-
 
285
		$this->assertArrayHasKey('auteur', $retour['resultat']['39607']);
267
		$this->assertEquals($nomSciHtml, $retour['resultat']['39607']['nom_sci']);
286
		$this->assertEquals('Gilib.', $retour['resultat']['39607']['auteur']);
268
	}
287
	}
269
}
288
}
270
?>
289
?>