/** * 处理请求 * */ private function _handleRequest() { try { $context = new Context(); $ctrl_r = new ControlResolver(); $ctrl = $ctrl_r->getController($context); $ctrl->execute($context); } catch (\Exceptions\ResolverException $e) { log_message(LOG_ERR, "ResolverException:" . $e->getMessage()); $context->err_echo("the Server ResolverException\n"); } catch (\Exceptions\EchoException $e) { log_message(LOG_ERR, "EchoException:" . $e->getMessage()); $context->err_echo("the Server EchoException\n"); } catch (Exception $e) { log_message(LOG_ERR, "Exception:" . $e->getMessage()); $context->err_echo("the Server Exception\n"); } }
/** * @param $arg_path */ public static function setAppPath($arg_path) { if (is_dir($arg_path)) { self::$_AppPath = $arg_path; } }
/** * 控制器无法通过过滤器异常 * * @expectedException Exceptions\ResolverException * @expectedExceptionMessage Command cannot pass filter */ public function testNoFilter() { AppHelper::Instance()->config("CMD_FILTER", '/Controller$/'); $_GET["cmd"] = "NoClassExist"; $context = new Context(); $ctrl_r = new ControlResolver(); $ctrl = $ctrl_r->getController($context); }