Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 783 | Rev 834 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
240 delphine 1
<?php
2
require_once dirname(__FILE__).'/../ServiceEflorePhpUnit.php';
3
 
4
class CommunOntologiesTest extends ServiceEflorePhpUnit {
5
 
6
	public function __construct() {
783 raphael 7
		$this->projet = 'eflore';
240 delphine 8
		$this->service = 'ontologies';
9
	}
10
 
11
	public function testRecherche() {
12
		$ressources = array();
13
		$parametres = array();
790 raphael 14
		$url = ServiceEflorePhpUnit::creerUrl($this->service, $ressources, $parametres);
15
		$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
240 delphine 16
		$this->assertNotEmpty($retour, 'données absentes');
17
		$this->assertArrayHasKey('total', $retour['entete'], "Le json ne contient pas d'attribut : total. Voir : $url");
783 raphael 18
		// au 20/08/2013, n°23 = Baznat
19
		$this->assertEquals('23', $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur '23'. Voir : $url");
240 delphine 20
		$this->assertArrayHasKey('nom', $retour['resultat'][1], "Le json ne contient pas d'attribut : nom. Voir : $url");
21
		$this->assertEquals('contactType', $retour['resultat'][1]['nom'], "L'attribut 'nom' devrait avoir la valeur 'contactType'. Voir : $url");
22
	}
23
 
24
	public function testMasqueCode() {
25
		$ressources = array();
26
		$parametres = array('masque.code' => 'o');
790 raphael 27
		$url = ServiceEflorePhpUnit::creerUrl($this->service, $ressources, $parametres);
28
		$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
240 delphine 29
		$this->assertNotEmpty($retour, 'données absentes');
30
		$this->assertArrayHasKey('total', $retour['entete'], "Le json ne contient pas d'attribut : total. Voir : $url");
31
		$this->assertEquals('1', $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur '1'. Voir : $url");
32
		$this->assertArrayHasKey('nom', $retour['resultat'][4], "Le json ne contient pas d'attribut : nom. Voir : $url");
33
		$this->assertEquals('organisations', $retour['resultat'][4]['nom'], "L'attribut 'nom' devrait avoir la valeur 'organisations'. Voir : $url");
34
	}
35
 
36
	public function testMasqueDescription() {
37
		$ressources = array();
38
		$parametres = array('masque.description' => '%contact');
790 raphael 39
		$url = ServiceEflorePhpUnit::creerUrl($this->service, $ressources, $parametres);
40
		$retour = $this->consulterJson($this->service, $this->projet, $ressources, $parametres);
240 delphine 41
		$this->assertNotEmpty($retour, 'données absentes');
42
		$this->assertArrayHasKey('total', $retour['entete'], "Le json ne contient pas d'attribut : total. Voir : $url");
43
		$this->assertEquals('1', $retour['entete']['total'], "L'attribut 'total' devrait avoir la valeur '1'. Voir : $url");
44
		$this->assertArrayHasKey('nom', $retour['resultat'][1], "Le json ne contient pas d'attribut : nom. Voir : $url");
45
		$this->assertEquals('contactType', $retour['resultat'][1]['nom'], "L'attribut 'nom' devrait avoir la valeur 'contactType'. Voir : $url");
46
	}
47
}
48
?>