| Line 7... |
Line 7... |
| 7 |
*/
|
7 |
*/
|
| 8 |
require_once dirname(__FILE__).'/../ServiceEflorePhpUnit.php';
|
8 |
require_once dirname(__FILE__).'/../ServiceEflorePhpUnit.php';
|
| Line 9... |
Line 9... |
| 9 |
|
9 |
|
| Line -... |
Line 10... |
| - |
|
10 |
class CosteNomsTest extends ServiceEflorePhpUnit {
|
| - |
|
11 |
|
| - |
|
12 |
static $P = "coste";
|
| 10 |
class CosteNomsTest extends ServiceEflorePhpUnit {
|
13 |
static $S = "textes";
|
| 11 |
|
14 |
|
| 12 |
// test d'obtention d'information sur num_nom connu
|
15 |
// test d'obtention d'information sur num_nom connu
|
| 13 |
public function testRessource() {
|
16 |
public function testRessource() {
|
| 14 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", array(182));
|
17 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, array(182));
|
| 15 |
$retour = $this->consulterJson("textes2", "coste", array(182));
|
18 |
$retour = $this->consulterJson(self::$S, self::$P, array(182));
|
| 16 |
$this->commonTestHeader($retour, $url);
|
19 |
$this->commonTestHeader($retour, $url);
|
| 17 |
$this->assertEquals(1, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 1. Voir : $url");
|
20 |
$this->assertEquals(1, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 1. Voir : $url");
|
| 18 |
$this->commonTest($retour, $url);
|
21 |
$this->commonTest($retour, $url);
|
| 19 |
// tag peut peut-être varier à travers les décennies ?
|
22 |
// tag peut peut-être varier à travers les décennies ?
|
| 20 |
// testRechercheTag ?
|
23 |
// testRechercheTag ?
|
| 21 |
$this->assertArrayHasKey('tag', $retour['resultats']['182'], "Le json [182] ne contient pas d'élément tag. Voir : $url");
|
24 |
$this->assertArrayHasKey('tag', $retour['resultats']['182'], "Le json [182] ne contient pas d'élément tag. Voir : $url");
|
| Line 22... |
Line 25... |
| 22 |
$this->assertContains("HYBRIDA", $retour['resultats']['182']['texte'], "error: ['resultats']['182']['texte']. Voir : $url");
|
25 |
$this->assertContains("HYBRIDA", $retour['resultats']['182']['texte'], "error: ['resultats']['182']['texte']. Voir : $url");
|
| 23 |
}
|
26 |
}
|
| 24 |
|
27 |
|
| 25 |
public function testBdtfxRessource() {
|
28 |
public function testBdtfxRessource() {
|
| 26 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", array("bdtfx.nn:182"));
|
29 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, array("bdtfx.nn:182"));
|
| 27 |
$retour = $this->consulterJson("textes2", "coste", array("bdtfx.nn:182"));
|
30 |
$retour = $this->consulterJson(self::$S, self::$P, array("bdtfx.nn:182"));
|
| 28 |
$this->commonTestHeader($retour, $url);
|
31 |
$this->commonTestHeader($retour, $url);
|
| 29 |
$this->assertEquals(1, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 1. Voir : $url");
|
32 |
$this->assertEquals(1, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 1. Voir : $url");
|
| 30 |
$this->commonTest($retour, $url);
|
33 |
$this->commonTest($retour, $url);
|
| Line 31... |
Line 34... |
| 31 |
$this->assertArrayHasKey('tag', $retour['resultats']['182'], "Le json [182] ne contient pas d'élément tag. Voir : $url");
|
34 |
$this->assertArrayHasKey('tag', $retour['resultats']['182'], "Le json [182] ne contient pas d'élément tag. Voir : $url");
|
| 32 |
$this->assertContains("HYBRIDA", $retour['resultats']['182']['texte'], "error: ['resultats']['182']['texte']. Voir : $url");
|
35 |
$this->assertContains("HYBRIDA", $retour['resultats']['182']['texte'], "error: ['resultats']['182']['texte']. Voir : $url");
|
| 33 |
}
|
36 |
}
|
| 34 |
|
37 |
|
| 35 |
public function testNonExistantRessource() {
|
38 |
public function testNonExistantRessource() {
|
| Line 36... |
Line 39... |
| 36 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", array("-182"));
|
39 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, array("-182"));
|
| 37 |
$retour = $this->consulterBrut("textes2", "coste", array("-182"));
|
40 |
$retour = $this->consulterBrut(self::$S, self::$P, array("-182"));
|
| 38 |
$this->assertEquals("not supported", $retour, "error. Voir : $url");
|
41 |
$this->assertEquals("not supported", $retour, "error. Voir : $url");
|
| 39 |
}
|
42 |
}
|
| 40 |
|
43 |
|
| 41 |
// les critères se cumulent
|
44 |
// les critères se cumulent
|
| 42 |
public function testRessourceEtMasque() {
|
45 |
public function testRessourceEtMasque() {
|
| Line 43... |
Line 46... |
| 43 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", array(182), array("masque.ns" => "ABC"));
|
46 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, array(182), array("masque.ns" => "ABC"));
|
| 44 |
$retour = $this->consulterJson("textes2", "coste", array(182), array("masque.ns" => "ABC"));
|
47 |
$retour = $this->consulterJson(self::$S, self::$P, array(182), array("masque.ns" => "ABC"));
|
| 45 |
$this->commonTestHeader($retour, $url);
|
48 |
$this->commonTestHeader($retour, $url);
|
| 46 |
$this->assertEquals(0, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 0. Voir : $url");
|
49 |
$this->assertEquals(0, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 0. Voir : $url");
|
| 47 |
}
|
50 |
}
|
| Line 48... |
Line 51... |
| 48 |
|
51 |
|
| 49 |
public function testRessourceFormatHTML() {
|
52 |
public function testRessourceFormatHTML() {
|
| 50 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", array(182), array('txt.format' => 'htm'));
|
53 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, array(182), array('txt.format' => 'htm'));
|
| 51 |
$retour = $this->consulterJson("textes2", "coste", array(182), array('txt.format' => 'htm'));
|
54 |
$retour = $this->consulterJson(self::$S, self::$P, array(182), array('txt.format' => 'htm'));
|
| 52 |
$this->assertContains("span class", $retour['resultats']['182']['titre'], "error: ['resultats']['182']['titre']. Voir : $url");
|
55 |
$this->assertContains("span class", $retour['resultats']['182']['titre'], "error: ['resultats']['182']['titre']. Voir : $url");
|
| 53 |
}
|
56 |
}
|
| 54 |
|
57 |
|
| 55 |
public function testRessourceChamps() {
|
58 |
public function testRessourceChamps() {
|
| Line 66... |
Line 69... |
| 66 |
$this->assertEquals("Sapindaceae", $retour['resultats']['182']['famille'], "error: ['resultats']['182']['famille']. Voir : $url");
|
69 |
$this->assertEquals("Sapindaceae", $retour['resultats']['182']['famille'], "error: ['resultats']['182']['famille']. Voir : $url");
|
| 67 |
}
|
70 |
}
|
| Line 68... |
Line 71... |
| 68 |
|
71 |
|
| 69 |
|
72 |
|
| 70 |
public function testRechercheNS() {
|
73 |
public function testRechercheNS() {
|
| 71 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", NULL, array("masque.ns" => "Roemeria", "recherche" => "etendue"));
|
74 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, NULL, array("masque.ns" => "Roemeria", "recherche" => "etendue"));
|
| 72 |
$retour = $this->consulterJson("textes2", "coste", NULL, array("masque.ns" => "Roemeria", "recherche" => "etendue"));
|
75 |
$retour = $this->consulterJson(self::$S, self::$P, NULL, array("masque.ns" => "Roemeria", "recherche" => "etendue"));
|
| 73 |
$this->commonTestHeader($retour, $url);
|
76 |
$this->commonTestHeader($retour, $url);
|
| 74 |
$this->assertEquals(3, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 3. Voir : $url");
|
77 |
$this->assertEquals(3, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 3. Voir : $url");
|
| Line 75... |
Line 78... |
| 75 |
$this->commonTest($retour, $url);
|
78 |
$this->commonTest($retour, $url);
|
| 76 |
}
|
79 |
}
|
| 77 |
|
80 |
|
| 78 |
|
81 |
|
| 79 |
public function testRechercheTXT() {
|
82 |
public function testRechercheTXT() {
|
| 80 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", NULL, array("masque.txt" => "Nancy"));
|
83 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, NULL, array("masque.txt" => "Nancy"));
|
| Line 81... |
Line 84... |
| 81 |
$retour = $this->consulterJson("textes2", "coste", NULL, array("masque.txt" => "Nancy"));
|
84 |
$retour = $this->consulterJson(self::$S, self::$P, NULL, array("masque.txt" => "Nancy"));
|
| 82 |
$this->assertEquals(2, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 2. Voir : $url");
|
85 |
$this->assertEquals(2, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 2. Voir : $url");
|
| 83 |
$this->assertArrayHasKey("1774", $retour['resultats'], "error: ['resultats']['1774']. Voir : $url");
|
86 |
$this->assertArrayHasKey("1774", $retour['resultats'], "error: ['resultats']['1774']. Voir : $url");
|
| 84 |
$this->assertArrayHasKey("1775", $retour['resultats'], "error: ['resultats']['1775']. Voir : $url");
|
87 |
$this->assertArrayHasKey("1775", $retour['resultats'], "error: ['resultats']['1775']. Voir : $url");
|
| 85 |
|
88 |
|
| Line 86... |
Line 89... |
| 86 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", NULL, array("masque.txt" => "Nancy", "recherche" => "floue"));
|
89 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, NULL, array("masque.txt" => "Nancy", "recherche" => "floue"));
|
| 87 |
$retour = $this->consulterJson("textes2", "coste", NULL, array("masque.txt" => "Nancy", "recherche" => "floue"));
|
90 |
$retour = $this->consulterJson(self::$S, self::$P, NULL, array("masque.txt" => "Nancy", "recherche" => "floue"));
|
| 88 |
$this->assertEquals(2, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 2. Voir : $url");
|
91 |
$this->assertEquals(2, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 2. Voir : $url");
|
| 89 |
$this->assertArrayHasKey("1774", $retour['resultats'], "error: ['resultats']['1774']. Voir : $url");
|
92 |
$this->assertArrayHasKey("1774", $retour['resultats'], "error: ['resultats']['1774']. Voir : $url");
|
| Line 90... |
Line 93... |
| 90 |
$this->assertArrayHasKey("1775", $retour['resultats'], "error: ['resultats']['1775']. Voir : $url");
|
93 |
$this->assertArrayHasKey("1775", $retour['resultats'], "error: ['resultats']['1775']. Voir : $url");
|
| 91 |
|
94 |
|
| 92 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", NULL, array("masque.txt" => "Nancy", "masque.tome" => 2));
|
95 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, NULL, array("masque.txt" => "Nancy", "masque.tome" => 2));
|
| 93 |
$retour = $this->consulterJson("textes2", "coste", NULL, array("masque.txt" => "Nancy", "masque.tome" => 2));
|
96 |
$retour = $this->consulterJson(self::$S, self::$P, NULL, array("masque.txt" => "Nancy", "masque.tome" => 2));
|
| 94 |
$this->assertEquals(1, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 1. Voir : $url");
|
97 |
$this->assertEquals(1, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 1. Voir : $url");
|
| Line 95... |
Line 98... |
| 95 |
$this->assertArrayHasKey("1774", $retour['resultats'], "error: ['resultats']['1774']. Voir : $url");
|
98 |
$this->assertArrayHasKey("1774", $retour['resultats'], "error: ['resultats']['1774']. Voir : $url");
|
| 96 |
|
99 |
|
| 97 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", NULL, array("masque.txt" => "Nancy", "masque.page" => 0));
|
100 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, NULL, array("masque.txt" => "Nancy", "masque.page" => 0));
|
| 98 |
$retour = $this->consulterJson("textes2", "coste", NULL, array("masque.txt" => "Nancy", "masque.page" => 0));
|
101 |
$retour = $this->consulterJson(self::$S, self::$P, NULL, array("masque.txt" => "Nancy", "masque.page" => 0));
|
| 99 |
$this->assertEquals(1, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 1. Voir : $url");
|
102 |
$this->assertEquals(1, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 1. Voir : $url");
|
| 100 |
$this->assertArrayHasKey("1775", $retour['resultats'], "error: ['resultats']['1775']. Voir : $url");
|
103 |
$this->assertArrayHasKey("1775", $retour['resultats'], "error: ['resultats']['1775']. Voir : $url");
|
| 101 |
}
|
104 |
}
|
| 102 |
|
105 |
|
| 103 |
|
106 |
|
| 104 |
// par compatibilité, "titre" signifie une recherche sur "tag" (le titre de la page wiki de la description
|
107 |
// par compatibilité, "titre" signifie une recherche sur "tag" (le titre de la page wiki de la description
|
| 105 |
// ou des clefs de détermination)
|
108 |
// ou des clefs de détermination)
|
| Line 106... |
Line 109... |
| 106 |
public function testRechercheTag() {
|
109 |
public function testRechercheTag() {
|
| 107 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", NULL, array("masque.titre" => "Esp0131RoemeriaViolacea"));
|
110 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, NULL, array("masque.titre" => "Esp0131RoemeriaViolacea"));
|
| 108 |
$retour = $this->consulterJson("textes2", "coste", NULL, array("masque.titre" => "Esp0131RoemeriaViolacea"));
|
111 |
$retour = $this->consulterJson(self::$S, self::$P, NULL, array("masque.titre" => "Esp0131RoemeriaViolacea"));
|
| 109 |
$this->commonTestHeader($retour, $url);
|
112 |
$this->commonTestHeader($retour, $url);
|
| 110 |
$this->assertEquals(2, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 2. Voir : $url");
|
113 |
$this->assertEquals(2, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 2. Voir : $url");
|
| Line 111... |
Line 114... |
| 111 |
$this->commonTest($retour, $url);
|
114 |
$this->commonTest($retour, $url);
|
| 112 |
$this->assertArrayHasKey('tag', $retour['resultats']['182'], "Le json [182] ne contient pas d'élément tag. Voir : $url");
|
115 |
$this->assertArrayHasKey('tag', $retour['resultats']['182'], "Le json [182] ne contient pas d'élément tag. Voir : $url");
|
| 113 |
$this->assertEquals("Esp0131RoemeriaViolacea", $retour['resultats']['182']['tag'], "error: ['resultats']['182']['tag']. Voir : $url");
|
116 |
$this->assertEquals("Esp0131RoemeriaViolacea", $retour['resultats']['182']['tag'], "error: ['resultats']['182']['tag']. Voir : $url");
|
| 114 |
}
|
117 |
}
|
| Line 115... |
Line 118... |
| 115 |
|
118 |
|
| 116 |
public function testRechercheFamille() {
|
119 |
public function testRechercheFamille() {
|
| 117 |
// unknown famille
|
120 |
// unknown famille
|
| Line 118... |
Line 121... |
| 118 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", NULL, array("masque.famille" => "ABC"));
|
121 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, NULL, array("masque.famille" => "ABC"));
|
| 119 |
$retour = $this->consulterJson("textes2", "coste", NULL, array("masque.famille" => "ABC"));
|
122 |
$retour = $this->consulterJson(self::$S, self::$P, NULL, array("masque.famille" => "ABC"));
|
| 120 |
$this->assertEquals(0, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 0. Voir : $url");
|
123 |
$this->assertEquals(0, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 0. Voir : $url");
|
| Line 121... |
Line 124... |
| 121 |
|
124 |
|
| 122 |
// par famille, mais pas de recherche étendue pour ça
|
125 |
// par famille, mais pas de recherche étendue pour ça
|
| 123 |
$url = ServiceEflorePhpUnit::creerUrl("textes2", NULL, array("masque.famille" => "Sapind"));
|
126 |
$url = ServiceEflorePhpUnit::creerUrl(self::$S, NULL, array("masque.famille" => "Sapind"));
|
| 124 |
$retour = $this->consulterJson("textes2", "coste", NULL, array("masque.famille" => "Sapind"));
|
127 |
$retour = $this->consulterJson(self::$S, self::$P, NULL, array("masque.famille" => "Sapind"));
|
| Line 125... |
Line 128... |
| 125 |
$this->assertEquals(0, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 0. Voir : $url");
|
128 |
$this->assertEquals(0, $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur 0. Voir : $url");
|