11 * @author Johan Cwiklinski <johan@x-tnd.be>
12 * @copyright 2012-2014 The Galette Team
13 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
15 * @link http://galette.tuxfamily.org
16 * @since Available since 0.7.3dev 2012-12-12
20 if (file_exists('../galette/index.php')) {
21 $basepath = '../galette/';
22 } elseif (file_exists('galette/index.php')) {
23 $basepath = 'galette/';
25 die('Unable to define GALETTE_BASE_PATH :\'(');
29 $dbenv = getenv('DB');
32 ||
substr($dbenv, 0, strlen('postgres')) === 'postgres'
37 define('GALETTE_CONFIG_PATH', __DIR__
. '/config/' . $db . '/');
38 define('GALETTE_BASE_PATH', $basepath);
39 define('GALETTE_TESTS', true);
40 define('GALETTE_TESTS_PATH', __DIR__
);
41 define('GALETTE_MODE', 'PROD');
42 define('GALETTE_PLUGINS_PATH', GALETTE_TESTS_PATH
. '/plugins/');
43 define('GALETTE_TPL_SUBDIR', 'templates/default/');
44 define('GALETTE_THEME', 'themes/default/');
45 define('GALETTE_DATA_PATH', GALETTE_TESTS_PATH
. '/tests-data/');
46 if (is_dir(GALETTE_DATA_PATH
)) {
47 $files = new RecursiveIteratorIterator(
48 new RecursiveDirectoryIterator(
50 RecursiveDirectoryIterator
::SKIP_DOTS
52 RecursiveIteratorIterator
::CHILD_FIRST
55 foreach ($files as $fileinfo) {
56 $todo = ($fileinfo->isDir() ?
'rmdir' : 'unlink');
57 $todo($fileinfo->getRealPath());
59 rmdir(GALETTE_DATA_PATH
);
62 mkdir(GALETTE_DATA_PATH
);
74 foreach ($directories as $directory) {
75 mkdir(GALETTE_DATA_PATH
. $directory);
78 $logfile = 'galette_tests';
79 require_once GALETTE_BASE_PATH
. 'includes/galette.inc.php';
81 $session_name = 'galette_tests';
82 $session = new \RKA\
SessionMiddleware([
83 'name' => $session_name,
88 $gapp = new \Galette\Core\
SlimApp();
89 $app = $gapp->getApp();
92 require_once GALETTE_BASE_PATH
. '/includes/dependencies.php';
94 global $preferences, $emitter, $zdb;
95 $zdb = $container->get('zdb');
96 $preferences = $container->get('preferences');
97 $emitter = $container->get('event_manager');
98 $i18n->changeLanguage('en_US');
100 if (!defined('_CURRENT_THEME_PATH')) {
102 '_CURRENT_THEME_PATH',
103 GALETTE_THEMES_PATH
. $preferences->pref_theme
. '/'
107 $updateenv = getenv('UPDATE');
109 $updateenv !== 'UPDATE'
111 //do not initialize Ttiles on update tests
112 $titles = new \Galette\Repository\
Titles($zdb);
113 $res = $titles->installInit($zdb);
116 require_once __DIR__
. '/GaletteTestCase.php';