public static function init_http_services() { AppContext::set_request(new HTTPRequestCustom()); $response = new HTTPResponseCustom(); $response->set_default_attributes(); AppContext::set_response($response); }
public static function init() { Debug::enabled_current_script_debug(); Debug::set_plain_text_output_mode(); set_exception_handler(array('Debug', 'fatal')); self::setup_server_env(); self::fit_to_php_configuration(); self::load_static_constants(); self::load_dynamic_constants(); AppContext::set_request(new HTTPRequestCustom()); AppContext::set_session(SessionData::admin_session()); AppContext::set_current_user(new AdminUser()); AppContext::init_extension_provider_service(); AppContext::set_response(new HTTPResponseCustom()); }
<?php define('PATH_TO_ROOT', '..'); define('DEBUG', TRUE); require_once PATH_TO_ROOT . '/kernel/framework/core/environment/Environment.class.php'; Environment::load_imports(); Environment::load_static_constants(); AppContext::set_request(new HTTPRequestCustom()); Session::gc(); $session_data = Session::start(); AppContext::set_session($session_data); AppContext::init_current_user(); require_once PATH_TO_ROOT . '/test/PHPUnit/Framework.php'; if (isset($argv)) { array_shift($argv); $_REQUEST['params'] = implode(' ', $argv); $_REQUEST['is_html'] = false; } if (!empty($_REQUEST['params'])) { // Fake command line environment $argv = $_REQUEST['params']; $_SERVER['argv'] = explode(' ', '--configuration ./phpunit.cfg.xml ' . $argv); } else { $_SERVER['argv'] = array(); } $is_html = isset($_REQUEST['is_html']) && $_REQUEST['is_html'] == true; if (!$is_html) { echo '<pre>'; } //Debug::dump($_SERVER['argv']); require_once PATH_TO_ROOT . '/test/phpunit.php';