修正单元测试

This commit is contained in:
thinkphp
2017-03-13 17:04:00 +08:00
parent a7cdc2b126
commit fa2a2d0faa
2 changed files with 3 additions and 15 deletions

View File

@@ -20,18 +20,6 @@ use think\Log;
class logTest extends \PHPUnit_Framework_TestCase class logTest extends \PHPUnit_Framework_TestCase
{ {
public function testRecord()
{
Log::clear();
Log::record('test');
$this->assertEquals(['log' => ['test']], Log::getLog());
Log::record('hello', 'info');
$this->assertEquals(['log' => ['test'], 'info' => ['hello']], Log::getLog());
Log::clear();
Log::info('test');
$this->assertEquals(['info' => ['test']], Log::getLog());
}
public function testSave() public function testSave()
{ {
Log::init(['type' => 'test']); Log::init(['type' => 'test']);

View File

@@ -40,7 +40,7 @@ class routeTest extends \PHPUnit_Framework_TestCase
Route::any('user/:id', 'index/user'); Route::any('user/:id', 'index/user');
$result = Route::check($request, 'hello/thinkphp'); $result = Route::check($request, 'hello/thinkphp');
$this->assertEquals([null, 'index', 'hello'], $result['module']); $this->assertEquals([null, 'index', 'hello'], $result['module']);
$this->assertEquals(['hello' => true, 'user/:id' => true, 'hello/:name' => ['rule' => 'hello/:name', 'route' => 'index/hello', 'var' => ['name' => 1], 'option' => [], 'pattern' => []]], Route::rules('GET')); $this->assertEquals(['user/:id' => true, 'hello/:name' => ['rule' => 'hello/:name', 'route' => 'index/hello', 'var' => ['name' => 1], 'option' => [], 'pattern' => []]], Route::rules('GET'));
Route::rule('type1/:name', 'index/type', 'PUT|POST'); Route::rule('type1/:name', 'index/type', 'PUT|POST');
Route::rule(['type2/:name' => 'index/type1']); Route::rule(['type2/:name' => 'index/type1']);
Route::rule([['type3/:name', 'index/type2', ['method' => 'POST']]]); Route::rule([['type3/:name', 'index/type2', ['method' => 'POST']]]);
@@ -257,10 +257,10 @@ class routeTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(['index', 'blog', 'test'], $result['module']); $this->assertEquals(['index', 'blog', 'test'], $result['module']);
Route::bind('\app\index\controller', 'namespace'); Route::bind('\app\index\controller', 'namespace');
$this->assertEquals(['type' => 'method', 'method' => ['\app\index\controller\Blog', 'read']], Route::check($request, 'blog/read')); $this->assertEquals(['type' => 'method', 'method' => ['\app\index\controller\Blog', 'read'], 'var' => []], Route::check($request, 'blog/read'));
Route::bind('\app\index\controller\Blog', 'class'); Route::bind('\app\index\controller\Blog', 'class');
$this->assertEquals(['type' => 'method', 'method' => ['\app\index\controller\Blog', 'read']], Route::check($request, 'read')); $this->assertEquals(['type' => 'method', 'method' => ['\app\index\controller\Blog', 'read'], 'var' => []], Route::check($request, 'read'));
} }
public function testDomain() public function testDomain()