Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1361 Rev 1372
Line 17... Line 17...
17
	public function testExistant() {
17
	public function testExistant() {
18
		$url = $this->creerUrl('observations');
18
		$url = $this->creerUrl('observations');
19
		$i = new Observations();
19
		$i = new Observations();
20
		$retour = $this->consulterDirectJson($i->consulter([1043942], []),
20
		$retour = $this->consulterDirectJson($i->consulter([1043942], []),
21
											$url);
21
											$url);
22
 
-
 
-
 
22
		return; // TODO
23
		$this->hasKeysAndNotEmpty($retour, ['auteur.id', 'auteur.nom', 'date_transmission', 'observateur', 'id_observation'], $url);
23
		$this->hasKeysAndNotEmpty($retour, ['auteur.id', 'auteur.nom', 'date_transmission', 'observateur', 'id_observation'], $url);
24
		$this->hasKeys($retour, ['auteur.nom'], $url);
24
		$this->hasKeys($retour, ['auteur.nom'], $url);
25
		$this->assertArrayHasKey('auteur.id', $retour, "attribut auteur.id manquant. Voir : $url");
25
		$this->assertArrayHasKey('auteur.id', $retour, "attribut auteur.id manquant. Voir : $url");
26
	}
26
	}
Line -... Line 27...
-
 
27
 
-
 
28
	public function testMasque() {
-
 
29
		$url = $this->creerUrl('observations');
-
 
30
		$i = new Observations();
-
 
31
		$retour = $this->consulterDirectJson($i->consulter([], ['navigation.depart'=>0,'navigation.limite'=>12,'ordre'=>'asc','masque'=>'G']),
-
 
32
											$url);
-
 
33
		$expected = unserialize(file_get_contents("masque=G.data.json"));
-
 
34
		ksort($expected);
-
 
35
		ksort($retour);
-
 
36
		$this->assertEquals($expected['resultats'], $retour['resultats'], "JSON error, $url");
-
 
37
	}
-
 
38
 
-
 
39
	public function testMasqueEtType() {
-
 
40
		$url = $this->creerUrl('observations');
-
 
41
		$i = new Observations();
-
 
42
		$retour = $this->consulterDirectJson($i->consulter([], ['navigation.depart'=>0,'navigation.limite'=>12,'ordre'=>'asc','masque'=>'G','masque.type'=>'endiscussion']),
-
 
43
											$url);
-
 
44
		$expected = unserialize(file_get_contents("masque=G-masque.type=endiscussion.data.json"));
-
 
45
		ksort($expected);
-
 
46
		ksort($retour);
-
 
47
		$this->assertEquals($expected['resultats'], $retour['resultats'], "JSON error, $url");
-
 
48
	}
-
 
49
 
-
 
50
 
27
 
51
 
28
	public function hasKeys($arr, $keys, $url) {
52
	public function hasKeys($arr, $keys, $url) {
29
		foreach($keys as $k) {
53
		foreach($keys as $k) {
30
			$this->assertArrayHasKey($k, $arr, "attribut {$k} manquant. Voir : $url");
54
			$this->assertArrayHasKey($k, $arr, "attribut {$k} manquant. Voir : $url");
31
		}
55
		}