Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Regard whitespace Rev 1140 → Rev 1141

/trunk/tests/ConsultationEflorePhpUnit.php
1,5 → 1,4
<?php
// declare(encoding='UTF-8');
/**
* Classe contenant des méthodes :
* - d'intialisation des tests,
8,24 → 7,39
*
* @category php 5.3
* @package Tests/Services
* @author Raphaël Droz <raphael@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Copyright (c) 2011, Tela Botanica (accueil@tela-botanica.org)
* @copyright Copyright (c) 2011, 2013 Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
 
require_once __DIR__ . '/../framework.php';
abstract class ConsultationEflorePhpUnit extends PHPUnit_Framework_TestCase {
 
//+------------------------------------------------------------------------------------------------------+
// Intialisation
 
/* absolument nécessaire pour que Registre::$statics et Config::$statics soient réinitialisés lors
de multiples tests successifs (notamment pour le moteur de recherche).
*Et* l'annotation de setUpBeforeClass()
*et* l'attribut $backupStaticAttributes
*et* l'accès fictif @Registre::get(NULL);
sont tous trois nécessaires */
protected $backupStaticAttributes = true;
 
/**
* @backupStaticAttributes enabled
*/
public static function setUpBeforeClass() {
error_reporting(E_ALL);
self::chargerFramework();
 
if(!Framework::getCheminAppli()) {
Framework::setCheminAppli(__DIR__ . '/../');
// Enregistrement en première position des autoload de la méthode gérant les classes des services
spl_autoload_register(array(get_class(), 'chargerClasseAuto'));
}
Registre::get(NULL);
}
 
public static function chargerClasseAuto($classe) {
//echo $classe."\n";
50,21 → 64,6
}
}
 
private static function chargerFramework() {
$cheminRacine = realpath(dirname(__FILE__).'/..').'/';
$framework = $cheminRacine.'framework.php';
if (!file_exists($framework)) {
$e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
trigger_error($e, E_USER_ERROR);
} else {
// Inclusion du Framework
require_once $framework;
 
// Ajout d'information concernant cette application
Framework::setCheminAppli($cheminRacine);// Obligatoire
}
}
 
//+------------------------------------------------------------------------------------------------------+
// Refactorisation
protected function consulterJson($ressources, $parametres) {
98,8 → 97,7
$parametresUrl = '?'.implode('&', $parametresUrl);
}
 
$url = 'http://localhost/service:eflore:0.1'.$ressourcesUrl.$parametresUrl;
return $url;
return 'http://localhost/service:eflore:0.1'.$ressourcesUrl.$parametresUrl;
}
 
//+------------------------------------------------------------------------------------------------------+
116,8 → 114,7
* @return Object Le bouchon de la classe abstraite
*/
public function getClasseAbstraite($classeNom, Array $parametres) {
$efloreScript = $this->getMockForAbstractClass($classeNom, $parametres);
return $efloreScript;
return $this->getMockForAbstractClass($classeNom, $parametres);
}
 
/**