mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
49 lines
1.6 KiB
PHP
49 lines
1.6 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
// +----------------------------------------------------------------------
|
|
// | Author: liu21st <liu21st@gmail.com>
|
|
// +----------------------------------------------------------------------
|
|
|
|
/**
|
|
* Log测试
|
|
* @author liu21st <liu21st@gmail.com>
|
|
*/
|
|
namespace tests\thinkphp\library\think;
|
|
|
|
use think\Log;
|
|
|
|
class logTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
|
|
public function testRecord(){
|
|
Log::clear();
|
|
Log::record('test');
|
|
$this->assertEquals([['type'=>'log','msg'=>'test']], Log::getLog());
|
|
Log::record('hello','info');
|
|
$this->assertEquals([['type'=>'log','msg'=>'test'],['type'=>'info','msg'=>'hello']], Log::getLog());
|
|
Log::clear();
|
|
Log::info('test');
|
|
$this->assertEquals([['type'=>'info','msg'=>'test']], Log::getLog());
|
|
}
|
|
|
|
public function testSave(){
|
|
Log::init(['type'=>'test']);
|
|
Log::clear();
|
|
Log::record('test');
|
|
Log::record([1,2,3]);
|
|
$this->assertTrue(Log::save());
|
|
}
|
|
|
|
public function testWrite(){
|
|
Log::init(['type'=>'test']);
|
|
Log::clear();
|
|
$this->assertTrue(Log::write('hello','info'));
|
|
$this->assertTrue(Log::write([1,2,3],'log'));
|
|
}
|
|
}
|