Aleksander Machniak
2016-05-06 acf633c73bc8df9a5036bc52d7568f4213ab73c7
commit | author | age
b37954 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
25 if (!defined('INSTALL_PATH')) define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
26
27 define('TESTS_DIR', dirname(__FILE__) . '/');
28
29 if (@is_dir(TESTS_DIR . 'config')) {
30     define('RCUBE_CONFIG_DIR', TESTS_DIR . 'config');
31 }
32
33 require_once(INSTALL_PATH . 'program/include/iniset.php');
34
35 rcmail::get_instance('test')->config->set('devel_mode', false);
36
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 }