mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
修正单元测试
This commit is contained in:
@@ -150,7 +150,8 @@ return [
|
||||
// | Trace设置
|
||||
// +----------------------------------------------------------------------
|
||||
'trace' => [
|
||||
'type' => 'Html' //支持Html,Console 设为false则不显示
|
||||
//支持Html,Console 设为false则不显示
|
||||
'type' => false,
|
||||
],
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@@ -46,9 +46,15 @@ class Console
|
||||
$reqs = number_format(1 / $runtime, 2);
|
||||
$mem = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
||||
|
||||
if (isset($_SERVER['HTTP_HOST'])) {
|
||||
$uri = $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' : ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
} else {
|
||||
$uri = "cmd:" . implode(' ', $_SERVER['argv']);
|
||||
}
|
||||
|
||||
// 页面Trace信息
|
||||
$base = [
|
||||
'请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' : ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
|
||||
'请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $uri,
|
||||
'运行时间' => "{$runtime}s [ 吞吐率:{$reqs}req/s ] 内存消耗:{$mem}kb 文件加载:" . count(get_included_files()),
|
||||
'查询信息' => Db::$queryTimes . ' queries ' . Db::$executeTimes . ' writes ',
|
||||
'缓存信息' => Cache::$readTimes . ' reads,' . Cache::$writeTimes . ' writes',
|
||||
|
||||
@@ -48,8 +48,13 @@ class Html
|
||||
$mem = number_format((memory_get_usage() - START_MEM) / 1024, 2);
|
||||
|
||||
// 页面Trace信息
|
||||
if (isset($_SERVER['HTTP_HOST'])) {
|
||||
$uri = $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' : ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
} else {
|
||||
$uri = "cmd:" . implode(' ', $_SERVER['argv']);
|
||||
}
|
||||
$base = [
|
||||
'请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' : ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
|
||||
'请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $uri,
|
||||
'运行时间' => "{$runtime}s [ 吞吐率:{$reqs}req/s ] 内存消耗:{$mem}kb 文件加载:" . count(get_included_files()),
|
||||
'查询信息' => Db::$queryTimes . ' queries ' . Db::$executeTimes . ' writes ',
|
||||
'缓存信息' => Cache::$readTimes . ' reads,' . Cache::$writeTimes . ' writes',
|
||||
|
||||
@@ -54,10 +54,10 @@ class appTest extends \PHPUnit_Framework_TestCase
|
||||
$this->expectOutputString($expectOutputString);
|
||||
|
||||
$rc = new ReflectionClass('\think\Loader');
|
||||
$ns = $rc->getProperty('namespace');
|
||||
$ns = $rc->getProperty('prefixDirsPsr4');
|
||||
$ns->setAccessible(true);
|
||||
$namespace = $ns->getValue();
|
||||
$this->assertEquals(TEST_PATH, $namespace['tests']);
|
||||
$this->assertEquals([TEST_PATH], $namespace['tests\\']);
|
||||
|
||||
$this->assertEquals(true, function_exists('lang'));
|
||||
$this->assertEquals(true, function_exists('config'));
|
||||
|
||||
@@ -84,7 +84,7 @@ class routeTest extends \PHPUnit_Framework_TestCase
|
||||
Route::map('hello', 'index/hello');
|
||||
$this->assertEquals('index/hello', Route::map('hello'));
|
||||
$result = Route::check($request, 'hello');
|
||||
$this->assertEquals(['index', 'hello', null], $result['module']);
|
||||
$this->assertEquals([null, 'index', 'hello'], $result['module']);
|
||||
}
|
||||
|
||||
public function testMixVar()
|
||||
|
||||
Reference in New Issue
Block a user