From d28dbf644eab3a6adf659cc120261654703a200f Mon Sep 17 00:00:00 2001 From: huangdijia Date: Tue, 22 Dec 2015 15:18:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96=E4=B8=A4=E5=A4=84=E5=86=99?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/app.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/library/think/app.php b/library/think/app.php index de6519f3..039e6a04 100644 --- a/library/think/app.php +++ b/library/think/app.php @@ -110,12 +110,10 @@ class App } // 操作方法执行完成监听 APP_HOOK && Hook::listen('action_end', $data); - // 返回数据 - if (IN_UNIT_TEST) { - return $data; - } else { - Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit')); - } + // 单元测试模式下返回数据 + if (IN_UNIT_TEST) { return $data; } + // 输出数据 + Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit')); } else { // 操作方法不是Public 抛出异常 throw new \ReflectionException(); @@ -127,12 +125,10 @@ class App $data = $method->invokeArgs($instance, [$action, '']); // 操作方法执行完成监听 APP_HOOK && Hook::listen('action_end', $data); - // 返回数据 - if (IN_UNIT_TEST) { - return $data; - } else { - Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit')); - } + // 单元测试模式下返回数据 + if (IN_UNIT_TEST) { return $data; } + // 输出数据 + Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit')); } else { throw new Exception('method [ ' . (new \ReflectionClass($instance))->getName() . '->' . $action . ' ] not exists ', 10002); }