mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-04 14:22:48 +08:00
改进单元测试
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
// 测试入口文件
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
// 定义项目测试基础路径
|
||||
define('TEST_PATH', __DIR__ . '/');
|
||||
// 定义项目路径
|
||||
|
||||
@@ -135,10 +135,7 @@ class debugTest extends \PHPUnit_Framework_TestCase
|
||||
$str .= "mem";
|
||||
}
|
||||
$memPeak = \think\Debug::getMemPeak($start, $end);
|
||||
|
||||
// echo "\r\n" . $memPeak . "\r\n";
|
||||
|
||||
$this->assertLessThan(238, explode(" ", $memPeak)[0]);
|
||||
$this->assertLessThan(355, explode(" ", $memPeak)[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,7 +165,7 @@ class debugTest extends \PHPUnit_Framework_TestCase
|
||||
$output = \think\Debug::dump($var, false, $label = "label");
|
||||
$array = explode("array", json_encode($output));
|
||||
if (IS_WIN) {
|
||||
$this->assertEquals("(1) {\\n 'key' =>\\n string(3) \\\"val\\\"\\n}\\n\\r\\n\"", end($array));
|
||||
$this->assertEquals("(1) {\\n [\\\"key\\\"] => string(3) \\\"val\\\"\\n}\\n\\r\\n\"", end($array));
|
||||
} else {
|
||||
$this->assertEquals("(1) {\\n 'key' =>\\n string(3) \\\"val\\\"\\n}\\n\\n\"", end($array));
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ class viewTest extends \PHPUnit_Framework_TestCase
|
||||
$view_instance = \think\View::instance();
|
||||
$method = new \ReflectionMethod('\think\View', 'ParseTemplate');
|
||||
$method->setAccessible(true);
|
||||
$this->assertEquals('/theme_name/template_name.html', $method->invoke($view_instance, 'template_name'));
|
||||
$this->assertEquals(DS . 'theme_name' . DS . 'template_name.html', $method->invoke($view_instance, 'template_name'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,6 +137,6 @@ class viewTest extends \PHPUnit_Framework_TestCase
|
||||
$view_instance = \think\View::instance();
|
||||
$method = new \ReflectionMethod('\think\View', 'getThemePath');
|
||||
$method->setAccessible(true);
|
||||
$this->assertEquals('/theme_name/', $method->invoke($view_instance));
|
||||
$this->assertEquals(DS . 'theme_name' . DS, $method->invoke($view_instance));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user