Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 357 → Rev 358

/trunk/services/modules/0.1/bdtfx/CommunNomsTaxons.php
342,7 → 342,8
if (strrpos($champ, '.*') !== false) {
$this->afficherPointEtoile($champ, $reponse_id);
} elseif (in_array($champ, $champs_a_libeller)) {
$this->table_retour[$champ.'.libelle'] = (isset($reponse_id[$champ])) ? $reponse_id[$champ] : null;
$this->table_retour[$champ.'.libelle'] =
(isset($reponse_id[$champ.'.libelle'])) ? $reponse_id[$champ.'.libelle'] : null;
} else {
$champ = $this->trouverChampBddCorrespondant($champ);
$this->table_retour[$champ] = (isset($reponse_id[$champ])) ? $reponse_id[$champ] : null;
/trunk/services/tests/0.1/bdtfx/BdtfxNomsTest.php
183,7 → 183,7
$this->assertEquals('1', $retour['entete']['total'], "L'attribut 'total' de l'entête devrait valoir 1. Voir : $url");
 
$this->assertArrayHasKey('resultat', $retour, "Le json ne contient pas d'attribut : resultat. Voir : $url");
$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");
$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");
}
 
public function testNsStructureHtml() {
206,7 → 206,7
$this->assertArrayHasKey('resultat', $retour, "Le json ne contient pas d'attribut : resultat.\nVoir : $url");
$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>]';
$message = "Le tableau du résultat 182 doit contenir un champ 'nom_sci' avec pour valeur '$attendu'. Voir : $url";
$this->assertEquals($attendu, $retour['resultat']['182']['nom_sci'], $message);
$this->assertEquals($attendu, $retour['resultat']['182']['nom_sci_complet'], $message);
}
 
public function testListeNomsAvecParametreRetourChamps() {
245,7 → 245,7
$this->assertArrayHasKey('39607', $retour['resultat']);
$this->assertArrayHasKey('nom_sci', $retour['resultat']['39607']);
$nomSciTxt = 'Lolium annuum Gilib. [1792, Exercit. Phytol., 2 : 520] [nom. invalid.]';
$this->assertEquals($nomSciTxt, $retour['resultat']['39607']['nom_sci']);
$this->assertEquals($nomSciTxt, $retour['resultat']['39607']['nom_sci_complet']);
}
 
public function testListeNomAvecParametreNsStructureAuAnBibAdEtNsFormatHtm() {
264,7 → 264,26
$this->assertArrayHasKey('39607', $retour['resultat']);
$this->assertArrayHasKey('nom_sci', $retour['resultat']['39607']);
$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>]";
$this->assertEquals($nomSciHtml, $retour['resultat']['39607']['nom_sci']);
$this->assertEquals($nomSciHtml, $retour['resultat']['39607']['nom_sci_complet']);
}
public function testListeNomAvecParametreRetourChamps() {
$ressources = array();
$parametres = array('version.projet' => '1.01',
'masque.nn' => '39607',
'retour.champs' => 'rang,auteur');
$retour = $this->consulterJson($ressources, $parametres);
$this->assertArrayHasKey('entete', $retour);
$this->assertArrayHasKey('masque', $retour['entete']);
$this->assertEquals('num_nom=39607', $retour['entete']['masque']);
$this->assertArrayHasKey('resultat', $retour);
$this->assertArrayHasKey('39607', $retour['resultat']);
$this->assertArrayHasKey('rang.libelle', $retour['resultat']['39607']);
$this->assertEquals('Espèce', $retour['resultat']['39607']['rang.libelle']);
$this->assertArrayHasKey('auteur', $retour['resultat']['39607']);
$this->assertEquals('Gilib.', $retour['resultat']['39607']['auteur']);
}
}
?>