Exemplo n.º 1
0
    try {
        if ($dbhash = $DB->get_field('config', 'value', array('name' => 'phpunittest'))) {
            // reset DB tables
            phpunit_util::reset_database();
        }
    } catch (Exception $e) {
        if ($dbhash) {
            // we ned to reinit if reset fails
            $DB->set_field('config', 'value', 'na', array('name' => 'phpunittest'));
        }
    }
    unset($dbhash);
}
// Load up any configuration from the config table or MUC cache.
if (PHPUNIT_TEST) {
    phpunit_util::initialise_cfg();
} else {
    initialise_cfg();
}
if (isset($CFG->debug)) {
    $CFG->debug = (int) $CFG->debug;
    error_reporting($CFG->debug);
} else {
    $CFG->debug = 0;
}
$CFG->debugdeveloper = ($CFG->debug & DEBUG_DEVELOPER) === DEBUG_DEVELOPER;
// Find out if PHP configured to display warnings,
// this is a security problem because some moodle scripts may
// disclose sensitive information.
if (ini_get_bool('display_errors')) {
    define('WARN_DISPLAY_ERRORS_ENABLED', true);