Aleksander Machniak
2016-04-13 e2ff7985dbcf2ff56644cae9e8d14a06ce4242c3
commit | author | age
e82492 1 <?php
AM 2
3 /*
4  +-----------------------------------------------------------------------+
5  | tests/bootstrap.php                                                   |
6  |                                                                       |
7  | This file is part of the Roundcube Webmail client                     |
8  | Copyright (C) 2009-2012, The Roundcube Dev Team                       |
9  |                                                                       |
10  | Licensed under the GNU General Public License version 3 or            |
11  | any later version with exceptions for skins & plugins.                |
12  | See the README file for a full license statement.                     |
13  |                                                                       |
14  | PURPOSE:                                                              |
15  |   Environment initialization script for unit tests                    |
16  +-----------------------------------------------------------------------+
17  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
18  | Author: Aleksander Machniak <alec@alec.pl>                            |
19  +-----------------------------------------------------------------------+
20 */
21
22 if (php_sapi_name() != 'cli')
23   die("Not in shell mode (php-cli)");
24
0ea079 25 if (!defined('INSTALL_PATH')) define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
e82492 26
0ea079 27 define('TESTS_DIR', __DIR__ . '/');
e82492 28
AM 29 if (@is_dir(TESTS_DIR . 'config')) {
deb2b8 30     define('RCUBE_CONFIG_DIR', TESTS_DIR . 'config');
e82492 31 }
AM 32
33 require_once(INSTALL_PATH . 'program/include/iniset.php');
9b05f1 34
1b39d9 35 rcmail::get_instance(0, 'test')->config->set('devel_mode', false);
b00592 36
AM 37 // Extend include path so some plugin test won't fail
38 $include_path = ini_get('include_path') . PATH_SEPARATOR . TESTS_DIR . '..';
39 if (set_include_path($include_path) === false) {
40     die("Fatal error: ini_set/set_include_path does not work.");
41 }