logTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. /**
  12. * Log测试
  13. * @author liu21st <liu21st@gmail.com>
  14. */
  15. namespace tests\thinkphp\library\think;
  16. use think\Log;
  17. class logTest extends \PHPUnit_Framework_TestCase
  18. {
  19. public function testSave()
  20. {
  21. Log::init(['type' => 'test']);
  22. Log::clear();
  23. Log::record('test');
  24. Log::record([1, 2, 3]);
  25. $this->assertTrue(Log::save());
  26. }
  27. public function testWrite()
  28. {
  29. Log::init(['type' => 'test']);
  30. Log::clear();
  31. $this->assertTrue(Log::write('hello', 'info'));
  32. $this->assertTrue(Log::write([1, 2, 3], 'log'));
  33. }
  34. }