mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-03 14:02:47 +08:00
添加Redisd驱动及单元测试
This commit is contained in:
59
tests/thinkphp/library/think/cache/driver/redisdTest.php
vendored
Normal file
59
tests/thinkphp/library/think/cache/driver/redisdTest.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?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>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Redisd缓存驱动测试
|
||||
* @author 尘缘 <130775@qq.com>
|
||||
*/
|
||||
|
||||
namespace tests\thinkphp\library\think\cache\driver;
|
||||
|
||||
class redisdTest extends cacheTestCase
|
||||
{
|
||||
private $_cacheInstance = null;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
if (!extension_loaded("redis")) {
|
||||
$this->markTestSkipped("Redis没有安装,已跳过测试!");
|
||||
}
|
||||
\think\Cache::connect(array('type' => 'redis', 'expire' => 2));
|
||||
}
|
||||
|
||||
protected function getCacheInstance()
|
||||
{
|
||||
if (null === $this->_cacheInstance) {
|
||||
$this->_cacheInstance = new \think\cache\driver\Redisd(['length' => 3]);
|
||||
}
|
||||
return $this->_cacheInstance;
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$cache = $this->prepare();
|
||||
$this->assertEquals('string_test', $cache->get('string_test'));
|
||||
$this->assertEquals(11, $cache->get('number_test'));
|
||||
$result = $cache->get('array_test');
|
||||
$this->assertEquals('array_test', $result['array_test']);
|
||||
}
|
||||
|
||||
public function testStoreSpecialValues()
|
||||
{
|
||||
}
|
||||
|
||||
public function testExpire()
|
||||
{
|
||||
}
|
||||
|
||||
public function testQueue()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user