public function test_start()
 {
     $this->resetAfterTest();
     // Session must be started only once...
     \core\session\manager::start();
     $this->assertDebuggingCalled('Session was already started!', DEBUG_DEVELOPER);
 }
            } else {
                if (CLI_SCRIPT) {
                    // CLI scripts can not have session
                    define('NO_MOODLE_COOKIES', true);
                } else {
                    define('NO_MOODLE_COOKIES', false);
                }
            }
        }
    }
}
// Start session and prepare global $SESSION, $USER.
if (empty($CFG->sessiontimeout)) {
    $CFG->sessiontimeout = 7200;
}
\core\session\manager::start();
// Set default content type and encoding, developers are still required to use
// echo $OUTPUT->header() everywhere, anything that gets set later should override these headers.
// This is intended to mitigate some security problems.
if (AJAX_SCRIPT) {
    if (!core_useragent::supports_json_contenttype()) {
        // Some bloody old IE.
        @header('Content-type: text/plain; charset=utf-8');
        @header('X-Content-Type-Options: nosniff');
    } else {
        if (!empty($_FILES)) {
            // Some ajax code may have problems with json and file uploads.
            @header('Content-type: text/plain; charset=utf-8');
        } else {
            @header('Content-type: application/json; charset=utf-8');
        }