Prepare for version 4.9.3
[phpmyadmin.git] / test / bootstrap-dist.php
blob1c4d6eac1537366cd8a99d172d2646c77358b426
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Bootstrap for phpMyAdmin tests
6 * @package PhpMyAdmin-test
7 */
9 /**
10 * Set precision to sane value, with higher values
11 * things behave slightly unexpectedly, for example
12 * round(1.2, 2) returns 1.199999999999999956.
14 ini_set('precision', 14);
16 // Let PHP complain about all errors
17 error_reporting(E_ALL);
19 // Ensure PHP has set timezone
20 date_default_timezone_set('UTC');
22 // Adding phpMyAdmin sources to include path
23 set_include_path(
24 get_include_path() . PATH_SEPARATOR . dirname(realpath("../index.php"))
27 // Setting constants for testing
28 define('PHPMYADMIN', 1);
29 define('TESTSUITE', 1);
31 // Selenium tests setup
32 $test_defaults = array(
33 'TESTSUITE_SERVER' => 'localhost',
34 'TESTSUITE_USER' => 'root',
35 'TESTSUITE_PASSWORD' => '',
36 'TESTSUITE_DATABASE' => 'test',
37 'TESTSUITE_URL' => 'http://localhost/phpmyadmin/',
38 'TESTSUITE_SELENIUM_HOST' => '',
39 'TESTSUITE_SELENIUM_PORT' => '4444',
40 'TESTSUITE_SELENIUM_BROWSER' => 'firefox',
41 'TESTSUITE_SELENIUM_COVERAGE' => '',
42 'TESTSUITE_BROWSERSTACK_USER' => '',
43 'TESTSUITE_BROWSERSTACK_KEY' => '',
44 'TESTSUITE_FULL' => '',
45 'CI_MODE' => ''
47 if (PHP_SAPI == 'cli') {
48 foreach ($test_defaults as $varname => $defvalue) {
49 $envvar = getenv($varname);
50 if ($envvar) {
51 $GLOBALS[$varname] = $envvar;
52 } else {
53 $GLOBALS[$varname] = $defvalue;
58 require_once 'libraries/vendor_config.php';
59 require_once AUTOLOAD_FILE;
60 PhpMyAdmin\MoTranslator\Loader::loadFunctions();
61 $CFG = new PhpMyAdmin\Config();
62 // Initialize PMA_VERSION variable
63 define('PMA_VERSION', $CFG->get('PMA_VERSION'));
64 define('PMA_MAJOR_VERSION', $CFG->get('PMA_MAJOR_VERSION'));
65 unset($CFG);
67 /* Ensure default langauge is active */
68 PhpMyAdmin\LanguageManager::getInstance()->getLanguage('en')->activate();
70 /* Load Database interface */
71 PhpMyAdmin\DatabaseInterface::load();
73 // Set proxy information from env, if available
74 $http_proxy = getenv('http_proxy');
75 if (PHP_SAPI == 'cli' && $http_proxy && ($url_info = parse_url($http_proxy))) {
76 define('PROXY_URL', $url_info['host'] . ':' . $url_info['port']);
77 define('PROXY_USER', empty($url_info['user']) ? '' : $url_info['user']);
78 define('PROXY_PASS', empty($url_info['pass']) ? '' : $url_info['pass']);
79 } else {
80 define('PROXY_URL', '');
81 define('PROXY_USER', '');
82 define('PROXY_PASS', '');
85 // Ensure we have session started
86 session_start();
88 // Standard environment for tests
89 $_SESSION[' PMA_token '] = 'token';
90 $GLOBALS['PMA_Theme'] = PhpMyAdmin\Theme::load('./themes/pmahomme');
91 $_SESSION['tmpval']['pftext'] = 'F';
92 $GLOBALS['lang'] = 'en';
93 $GLOBALS['PMA_Config'] = new PhpMyAdmin\Config();
95 // Check whether we have runkit extension
96 define('PMA_HAS_RUNKIT', function_exists('runkit_constant_redefine'));
97 $GLOBALS['runkit_internal_override'] = ini_get('runkit.internal_override');