Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 202 → Rev 203

/trunk/services/tests/0.2/ServicePhpUnit.php
16,7 → 16,8
*/
abstract class ServicePhpUnit extends PHPUnit_Framework_TestCase {
 
protected static $projet = '';
protected static $cheminBase = '';
protected $projet = '';
protected $service = '';
protected $classeTestee = '';
protected $baseUrl = 'http://localhost/service:eflore:0.1/';
26,9 → 27,8
 
public static function setUpBeforeClass() {
error_reporting(E_ALL);
 
self::chargerFramework();
 
self::$cheminBase = realpath(__DIR__.'/../../modules/0.2').'/';
// Enregistrement en première position des autoload de la méthode gérant les classes des services
spl_autoload_register(array(get_class($this), 'chargerClasseAuto'));
}
37,14 → 37,20
if (class_exists($classe)) {
return null;
}
$cheminBase = realpath(__DIR__.'/../../modules/0.2').'/';
$cheminProjet = $cheminBase.self::$projet.'/';
 
$cheminBibliotheque = realpath(__DIR__.'/../../bibliotheque').'/';
$cheminBiblioInterfaces = $cheminBibliotheque.'interfaces/';
$cheminBiblioNom = $cheminBibliotheque.'nom/';
$cheminBiblioNomDeco = $cheminBiblioNom.'decorateurs/';
$cheminsTests = __DIR__.'/';
$chemins = array($cheminBase, $cheminProjet, $cheminBibliotheque, $cheminsTests, $cheminBiblioNom,
$chemins = array(
self::$cheminBase,
$cheminBibliotheque,
$cheminsTests,
$cheminBiblioInterfaces,
$cheminBiblioNom,
$cheminBiblioNomDeco);
 
foreach ($chemins as $chemin) {
$chemin = $chemin.$classe.'.php';
if (file_exists($chemin)) {
79,10 → 85,11
 
protected function consulterBrut($ressources, $parametres) {
array_unshift($ressources, $this->service);
array_unshift($ressources, self::$projet);
array_unshift($ressources, $this->projet);
$Bdd = new Bdd();
$Ressources = new Ressources($ressources);
$Parametres = new Parametres($parametres, $Bdd);
require_once self::$cheminBase.$this->projet.'/'.$this->classeTestee.'.php';
$objetService = new $this->classeTestee($Ressources, $Parametres, $Bdd);
$this->initialiserService($objetService);
$retourJson = $objetService->consulter();
104,7 → 111,7
}
$parametresUrl = '?'.implode('&', $parametresUrl);
}
$url = $this->baseUrl.self::$projet.'/'.$version.$this->service.$ressourcesUrl.$parametresUrl;
$url = $this->baseUrl.$this->projet.'/'.$version.$this->service.$ressourcesUrl.$parametresUrl;
return $url;
}