require_once "{$CFG->dirroot}/lib/phpunit/lib.php"; // finish moodle init define('ABORT_AFTER_CONFIG_CANCEL', true); require "{$CFG->dirroot}/lib/setup.php"; raise_memory_limit(MEMORY_EXTRA); if (defined('PHPUNIT_CLI_UTIL')) { // all other tests are done in the CLI scripts... return; } if (!phpunit_util::is_testing_ready()) { phpunit_bootstrap_error('Database is not initialised to run unit tests, please use "php admin/tool/phpunit/cli/util.php --install"', 132); } // refresh data in all tables, clear caches, etc. phpunit_util::reset_all_data(); // store fresh globals phpunit_util::init_globals(); //========================================================= /** * Print error and stop execution * @param string $text An error message to display * @param int $errorcode The error code (see docblock for detailed list) * @return void stops code execution with error code */ function phpunit_bootstrap_error($text, $errorcode = 1) { fwrite(STDERR, $text . "\n"); exit($errorcode); } /** * Mark empty dataroot to be used for testing. * @param string $dataroot The dataroot directory