| Line 4... |
Line 4... |
| 4 |
class NomDetailsBdtfxTest extends ServicePhpUnit {
|
4 |
class NomDetailsBdtfxTest extends ServicePhpUnit {
|
| Line 5... |
Line 5... |
| 5 |
|
5 |
|
| 6 |
private $nomDetailSqueletteUrl = 'http://localhost/service:eflore:0.1/bdtfx/noms/%s';
|
6 |
private $nomDetailSqueletteUrl = 'http://localhost/service:eflore:0.1/bdtfx/noms/%s';
|
| 7 |
private $ontologieHrefTpl = 'http://localhost/service:eflore:0.1/bdnt/ontologies/rangTaxo:%s';
|
7 |
private $ontologieHrefTpl = 'http://localhost/service:eflore:0.1/bdnt/ontologies/rangTaxo:%s';
|
| 8 |
private $champsProjet = array(
|
- |
|
| 9 |
'nom_scientifique' => 'nom_scientifique',
|
- |
|
| 10 |
'auteur_origine' => 'auteur_origine',
|
- |
|
| 11 |
'nom_vernaculaire' => 'nom_vernaculaire',
|
- |
|
| 12 |
'page' => 'page',
|
- |
|
| 13 |
'code_taxon' => 'code_taxon',
|
- |
|
| 14 |
'milieu' => 'milieu',
|
- |
|
| 15 |
'floraison' => 'floraison',
|
- |
|
| 16 |
'type' => 'type',
|
- |
|
| 17 |
'sol' => 'sol',
|
8 |
private $champsProjet = array(
|
| 18 |
'rarete_region_alt' => 'rarete_region_alt',
|
9 |
'presence_Ga' => 'presence_Ga.code',
|
| 19 |
'region_bota_monde' => 'region_bota_monde',
|
- |
|
| 20 |
'etymologie' => 'etymologie',
|
- |
|
| 21 |
'taille' => 'taille',
|
- |
|
| 22 |
'formule_hybridite' => 'formule_hybridite',
|
10 |
'presence_Co' => 'presence_Co.code'
|
| Line 23... |
Line 11... |
| 23 |
'culture' => 'culture');
|
11 |
);
|
| 24 |
|
12 |
|
| 25 |
public function __construct() {
|
13 |
public function __construct() {
|
| 26 |
self::$projet = 'fournier';
|
14 |
$this->projet = 'bdtfx';
|
| 27 |
$this->service = 'noms';
|
15 |
$this->service = 'noms';
|
| Line 28... |
Line 16... |
| 28 |
$this->classeTestee = 'NomDetails';
|
16 |
$this->classeTestee = 'NomDetailsBdtfx';
|
| 29 |
}
|
17 |
}
|
| 30 |
|
18 |
|
| 31 |
public function initialiserService(NomsListe $service) {
|
19 |
public function initialiserService(NomsListe $service) {
|
| 32 |
$service->setDetailsHrefTpl($this->nomDetailSqueletteUrl);
|
20 |
$service->setDetailsHrefTpl($this->nomDetailSqueletteUrl);
|
| Line 33... |
Line 21... |
| 33 |
$service->setOntologieHrefTpl($this->ontologieHrefTpl);
|
21 |
$service->setOntologieHrefTpl($this->ontologieHrefTpl);
|
| 34 |
$service->setChampsProjets($this->champsProjet);
|
22 |
$service->setChampsProjet($this->champsProjet);
|
| 35 |
}
|
23 |
}
|
| Line 42... |
Line 30... |
| 42 |
|
30 |
|
| 43 |
$this->assertTrue(is_array($retour), 'Retour est un tableau');
|
31 |
$this->assertTrue(is_array($retour), 'Retour est un tableau');
|
| 44 |
$this->assertArrayHasKey('id', $retour, 'Présence champ id');
|
32 |
$this->assertArrayHasKey('id', $retour, 'Présence champ id');
|
| 45 |
$this->assertSame(85, $retour['id'], 'Valeur champ id = 85');
|
33 |
$this->assertSame(85, $retour['id'], 'Valeur champ id = 85');
|
| - |
|
34 |
$this->assertArrayHasKey('nom_sci', $retour, 'Présence champ nom_sci');
|
| 46 |
$this->assertArrayHasKey('nom_sci', $retour, 'Présence champ nom_sci');
|
35 |
|
| 47 |
$this->assertSame('Hymenophyllum peltatum', $retour['nom_sci'], 'Valeur champ nom_sci = Hymenophyllum peltatum');
|
36 |
$this->assertSame('Abutilon theophrasti', $retour['nom_sci'], 'Valeur champ nom_sci = Abutilon theophrasti');
|
| 48 |
$this->assertArrayHasKey('nom_retenu.id', $retour, 'Présence champ nom_retenu.id');
|
37 |
$this->assertArrayHasKey('nom_retenu.id', $retour, 'Présence champ nom_retenu.id');
|
| 49 |
$this->assertSame(84, $retour['nom_retenu.id'], 'Valeur champ nom_sci = 84');
|
38 |
$this->assertSame(85, $retour['nom_retenu.id'], 'Valeur champ nom_sci = 85');
|
| 50 |
$this->assertArrayHasKey('nom_retenu', $retour, 'Présence champ nom_retenu');
|
39 |
$this->assertArrayHasKey('nom_retenu', $retour, 'Présence champ nom_retenu');
|
| 51 |
$this->assertSame('Hymenophyllum unilaterale', $retour['nom_retenu'], 'Valeur champ nom_sci = 84');
|
40 |
$this->assertSame('Abutilon theophrasti', $retour['nom_retenu'], 'Valeur champ nom_retenu = Abutilon theophrasti');
|
| 52 |
$this->assertArrayHasKey('nom_retenu.href', $retour, 'Présence champ nom_retenu.href');
|
41 |
$this->assertArrayHasKey('nom_retenu.href', $retour, 'Présence champ nom_retenu.href');
|
| 53 |
$urlNomRetenuHrefAttendue = sprintf($this->nomDetailSqueletteUrl, 84);
|
42 |
$urlNomRetenuHrefAttendue = sprintf($this->nomDetailSqueletteUrl, 85);
|
| Line 54... |
Line 43... |
| 54 |
$this->assertSame($urlNomRetenuHrefAttendue, $retour['nom_retenu.href'], "Valeur champ nom_retenu.href = $urlNomRetenuHrefAttendue");
|
43 |
$this->assertSame($urlNomRetenuHrefAttendue, $retour['nom_retenu.href'], "Valeur champ nom_retenu.href = $urlNomRetenuHrefAttendue");
|
| 55 |
|
44 |
|
| 56 |
$this->assertArrayHasKey('rang.code', $retour, 'Présence champ rang.code');
|
45 |
$this->assertArrayHasKey('rang.code', $retour, 'Présence champ rang.code');
|
| Line 60... |
Line 49... |
| 60 |
|
49 |
|
| 61 |
$this->assertArrayHasKey('rang.href', $retour, 'Présence champ rang.href');
|
50 |
$this->assertArrayHasKey('rang.href', $retour, 'Présence champ rang.href');
|
| 62 |
$hrefAttendue =sprintf($this->ontologieHrefTpl, 290);
|
51 |
$hrefAttendue =sprintf($this->ontologieHrefTpl, 290);
|
| Line -... |
Line 52... |
| - |
|
52 |
$this->assertSame($hrefAttendue, $retour['rang.href'], "Valeur champ rang.href = $hrefAttendue");
|
| - |
|
53 |
|
| - |
|
54 |
$this->assertArrayHasKey('nom_sci.genre', $retour, 'Présence champ nom_sci.genre');
|
| - |
|
55 |
$this->assertSame('Abutilon', $retour['nom_sci.genre'], "Valeur champ nom_sci.genre = 'Abutilon'");
|
| - |
|
56 |
$this->assertArrayHasKey('nom_sci.sp', $retour, 'Présence champ nom_sci.sp');
|
| - |
|
57 |
$this->assertSame('theophrasti', $retour['nom_sci.sp'], "Valeur champ nom_sci.sp = theophrasti");
|
| - |
|
58 |
|
| - |
|
59 |
$this->assertArrayHasKey('auteur', $retour, 'Présence champ auteur');
|
| - |
|
60 |
$this->assertSame('Medik.', $retour['auteur'], "Valeur champ auteur = 'Medik.'");
|
| - |
|
61 |
|
| - |
|
62 |
$this->assertArrayHasKey('presence_Ga.code', $retour, 'Présence champ presence_Ga.code'.print_r($retour,true));
|
| - |
|
63 |
$this->assertSame('P', $retour['presence_Ga.code'], "Valeur champ presence_Ga.code = 'P'");
|
| - |
|
64 |
$this->assertArrayHasKey('presence_Co.code', $retour, 'Présence champ "presence_Co.code');
|
| - |
|
65 |
$this->assertSame('P', $retour['presence_Co.code'], "Valeur champ page = P");
|
| - |
|
66 |
}
|
| - |
|
67 |
|
| - |
|
68 |
public function testNomSansCorrespondance() {
|
| - |
|
69 |
$ressources = array('98940');
|
| - |
|
70 |
$parametres = array();
|
| - |
|
71 |
|
| - |
|
72 |
$retour = $this->consulterBrut($ressources, $parametres);
|
| - |
|
73 |
|
| - |
|
74 |
$this->assertArrayNotHasKey('nom_retenu.id', $retour, 'Abscence champ nom_retenu.id');
|
| - |
|
75 |
$this->assertArrayHasKey('nom_retenu', $retour, 'Présence champ nom_retenu');
|
| 63 |
$this->assertSame($hrefAttendue, $retour['rang.href'], "Valeur champ rang.href = $hrefAttendue");
|
76 |
$this->assertSame(null, $retour['nom_retenu'], 'Valeur champ nom_retenu = null');
|
| Line 64... |
Line 77... |
| 64 |
|
77 |
$this->assertArrayNotHasKey('nom_retenu.href', $retour, 'Abscence champ nom_retenu.href');
|
| 65 |
}
|
78 |
}
|
| 66 |
|
79 |
|