/** * Reset CodeIgniter instance and assign new CodeIgniter instance as $this->CI */ public function resetInstance() { reset_instance(); if (!CIPHPUnitTest::wiredesignzHmvcInstalled()) { new CI_Controller(); } else { new CI(); new MX_Controller(); } $this->CI =& get_instance(); }
protected function createAndCallController($class, $method, $params) { ob_start(); $this->callHook('pre_controller'); // Run callablePreConstructor if ($this->callablePreConstructors !== []) { foreach ($this->callablePreConstructors as $callable) { $callable(); } } // Create controller if (CIPHPUnitTest::wiredesignzHmvcInstalled()) { new CI(); } $controller = new $class(); $CI =& get_instance(); // Set CodeIgniter instance to TestCase $this->testCase->setCI($CI); // Set default response code 200 set_status_header(200); // Run callable if ($this->callables !== []) { foreach ($this->callables as $callable) { $callable($CI); } } $this->callHook('post_controller_constructor'); // Call controller method call_user_func_array([$controller, $method], $params); $this->callHook('post_controller'); if ($this->callHook('display_override') === false) { $CI->output->_display(); } $output = ob_get_clean(); if ($output == '') { $output = $CI->output->get_output(); } return $output; }
/** * Reference to the CI_Controller method. * * Returns current CI instance object * * @return object * * modified by ci-phpunit-test */ function &get_instance() { if (!CIPHPUnitTest::wiredesignzHmvcInstalled()) { return CI_Controller::get_instance(); } else { return CI::$APP; } }