| Line 1... |
Line 1... |
| 1 |
<?php
|
1 |
<?php
|
| 2 |
// declare(encoding='UTF-8');
|
- |
|
| 3 |
/**
|
2 |
/**
|
| 4 |
* Classe contenant des méthodes :
|
3 |
* Classe contenant des méthodes :
|
| 5 |
* - d'intialisation des tests,
|
4 |
* - d'intialisation des tests,
|
| 6 |
* - refactorisant le code des tests,
|
5 |
* - refactorisant le code des tests,
|
| 7 |
* - facilitant les tests.
|
6 |
* - facilitant les tests.
|
| 8 |
*
|
7 |
*
|
| 9 |
* @category php 5.3
|
8 |
* @category php 5.4
|
| 10 |
* @package Tests/Services
|
9 |
* @package Tests/Services
|
| 11 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
10 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
| - |
|
11 |
* @author Raphaël Droz <raphael@tela-botanica.org>
|
| 12 |
* @copyright Copyright (c) 2011, Tela Botanica (accueil@tela-botanica.org)
|
12 |
* @copyright Copyright (c) 2011, 2013 Tela Botanica (accueil@tela-botanica.org)
|
| 13 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
13 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
| 14 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
14 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
| 15 |
* @version $Id$
|
- |
|
| 16 |
*/
|
15 |
*/
|
| - |
|
16 |
|
| 17 |
abstract class ServiceDelPhpUnit extends PHPUnit_Framework_TestCase {
|
17 |
abstract class ServiceDelPhpUnit extends PHPUnit_Framework_TestCase {
|
| Line 18... |
Line 18... |
| 18 |
|
18 |
|
| 19 |
/** Définir la valeur de cet attribut dans le constructeur de la classe de test.*/
|
19 |
/** Définir la valeur de cet attribut dans le constructeur de la classe de test.*/
|
| 20 |
protected $projet = '';
|
20 |
protected $projet = '';
|
| Line 71... |
Line 71... |
| 71 |
$url = $this->creerUrl($ressources, $parametres);
|
71 |
$url = $this->creerUrl($ressources, $parametres);
|
| 72 |
$this->assertEquals(JSON_ERROR_NONE, json_last_error(), "Le json contient des erreurs qui bloquent le décodage. Voir : $url\n".print_r($retourJson, true));
|
72 |
$this->assertEquals(JSON_ERROR_NONE, json_last_error(), "Le json contient des erreurs qui bloquent le décodage. Voir : $url\n".print_r($retourJson, true));
|
| 73 |
return $retour;
|
73 |
return $retour;
|
| 74 |
}
|
74 |
}
|
| Line -... |
Line 75... |
| - |
|
75 |
|
| - |
|
76 |
public function consulterDirectJson($json, $url) {
|
| - |
|
77 |
$retour = json_decode($json, true);
|
| - |
|
78 |
$this->assertEquals(JSON_ERROR_NONE,
|
| - |
|
79 |
json_last_error(),
|
| - |
|
80 |
"Le json contient des erreurs qui bloquent le décodage. Voir : $url\n" .
|
| - |
|
81 |
print_r($json, true));
|
| - |
|
82 |
return $retour;
|
| - |
|
83 |
}
|
| 75 |
|
84 |
|
| 76 |
protected function consulterBrut($ressources, $parametres) {
|
85 |
protected function consulterBrut($ressources, $parametres) {
|
| 77 |
array_unshift($ressources, $this->service);
|
86 |
array_unshift($ressources, $this->service);
|
| 78 |
array_unshift($ressources, $this->projet);
|
87 |
array_unshift($ressources, $this->projet);
|
| 79 |
$projets = new Del();
|
88 |
$projets = new Determinations();
|
| 80 |
$retourJson = $projets->consulter($ressources, $parametres);
|
89 |
$retourJson = $projets->consulter($ressources, $parametres);
|
| 81 |
return $retourJson;
|
90 |
return $retourJson;
|
| Line -... |
Line 91... |
| - |
|
91 |
}
|
| 82 |
}
|
92 |
|
| 83 |
|
93 |
|
| 84 |
protected function creerUrl($ressources, $parametres) {
|
94 |
protected function creerUrl($ressources, $parametres = []) {
|
| 85 |
$version = '';
|
95 |
$version = '';
|
| 86 |
$ressourcesUrl = array();
|
96 |
$ressourcesUrl = array();
|
| 87 |
foreach ($ressources as $ressource) {
|
97 |
foreach ($ressources as $ressource) {
|