Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 1371 → Rev 1372

/trunk/services/tests/0.1/observations/ObservationsTest.php
19,12 → 19,36
$i = new Observations();
$retour = $this->consulterDirectJson($i->consulter([1043942], []),
$url);
 
return; // TODO
$this->hasKeysAndNotEmpty($retour, ['auteur.id', 'auteur.nom', 'date_transmission', 'observateur', 'id_observation'], $url);
$this->hasKeys($retour, ['auteur.nom'], $url);
$this->assertArrayHasKey('auteur.id', $retour, "attribut auteur.id manquant. Voir : $url");
}
 
public function testMasque() {
$url = $this->creerUrl('observations');
$i = new Observations();
$retour = $this->consulterDirectJson($i->consulter([], ['navigation.depart'=>0,'navigation.limite'=>12,'ordre'=>'asc','masque'=>'G']),
$url);
$expected = unserialize(file_get_contents("masque=G.data.json"));
ksort($expected);
ksort($retour);
$this->assertEquals($expected['resultats'], $retour['resultats'], "JSON error, $url");
}
 
public function testMasqueEtType() {
$url = $this->creerUrl('observations');
$i = new Observations();
$retour = $this->consulterDirectJson($i->consulter([], ['navigation.depart'=>0,'navigation.limite'=>12,'ordre'=>'asc','masque'=>'G','masque.type'=>'endiscussion']),
$url);
$expected = unserialize(file_get_contents("masque=G-masque.type=endiscussion.data.json"));
ksort($expected);
ksort($retour);
$this->assertEquals($expected['resultats'], $retour['resultats'], "JSON error, $url");
}
 
 
 
public function hasKeys($arr, $keys, $url) {
foreach($keys as $k) {
$this->assertArrayHasKey($k, $arr, "attribut {$k} manquant. Voir : $url");