Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev Author Line No. Line
3 jpm 1
<?php
17 jpm 2
// declare(encoding='UTF-8');
3 jpm 3
/**
17 jpm 4
 * Script préparant le lancement des tests.
5
 *
6
 * @category	php 5.3
7
 * @package		Tests/Services
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @copyright	Copyright (c) 2011, Tela Botanica (accueil@tela-botanica.org)
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @version		$Id$
13
 */
14
error_reporting(E_ALL);
15
 
16
/**
3 jpm 17
* La méthode __autoload() charge dynamiquement les classes trouvées dans le code.
18
* Cette fonction est appelée par php5 quand il trouve une instanciation de classe dans le code.
19
*
20
*@param string le nom de la classe appelée.
21
*@return void le fichier contenant la classe doit être inclu par la fonction.
22
*/
23
function chargerClasse($classe) {
24
	if (class_exists($classe)) {
25
		return null;
26
	}
7 jpm 27
	$cheminBase = realpath(__DIR__.'/../modules/0.1').'/';
17 jpm 28
	$cheminsTests = __DIR__.'/';
29
	$chemins = array($cheminBase, $cheminsTests);
3 jpm 30
	foreach ($chemins as $chemin) {
31
		$chemin = $chemin.$classe.'.php';
32
		if (file_exists($chemin)) {
33
			require_once $chemin;
34
		}
35
	}
36
}
37
spl_autoload_register('chargerClasse');
38
 
39
// Le fichier autoload.inc.php du Framework de Tela Botanica doit être appelée avant tout autre chose dans l'application.
40
// Sinon, rien ne sera chargé.
41
// Chemin du fichier chargeant le framework requis
42
$framework = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'framework.php';
43
if (!file_exists($framework)) {
44
	$e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
45
	trigger_error($e, E_USER_ERROR);
46
} else {
47
	// Inclusion du Framework
48
	require_once $framework;
49
	// Ajout d'information concernant cette application
50
	Framework::setCheminAppli(realpath($framework));// Obligatoire
51
	Framework::setInfoAppli(Config::get('info'));
52
}
53
/*
54
* Local Variables:
55
* mode: php
56
* coding: utf-8
57
* tab-width: 4
58
* c-basic-offset: 4
59
* c-hanging-comment-ender-p: nil
60
* indent-tabs-mode: nil
61
* End:
62
*/
63
?>