增加缓存驱动的queue测试

This commit is contained in:
thinkphp
2016-02-28 22:37:10 +08:00
parent 92e7ca7a1b
commit e3a95fe994
4 changed files with 13 additions and 12 deletions

View File

@@ -50,14 +50,4 @@ class apcTest extends cacheTestCase
{
}
public function testQueue()
{
$cache = $this->getCacheInstance();
$this->assertTrue($cache->set('1', '1'));
$this->assertTrue($cache->set('2', '2'));
$this->assertTrue($cache->set('3', '3'));
$this->assertEquals(1, $cache->get('1'));
$this->assertTrue($cache->set('4', '4'));
$this->assertFalse($cache->get('1'));
}
}

View File

@@ -159,4 +159,15 @@ abstract class cacheTestCase extends \PHPUnit_Framework_TestCase
$this->assertEquals('a', Cache::get('a'));
$this->assertNotNull(Cache::rm('a'));
}
public function testQueue()
{
$cache = $this->prepare();
$this->assertTrue($cache->set('1', '1'));
$this->assertTrue($cache->set('2', '2'));
$this->assertTrue($cache->set('3', '3'));
$this->assertEquals(1, $cache->get('1'));
$this->assertTrue($cache->set('4', '4'));
$this->assertFalse($cache->get('1'));
}
}

View File

@@ -35,7 +35,7 @@ class memcachedTest extends cacheTestCase
protected function getCacheInstance()
{
if (null === $this->_cacheInstance) {
$this->_cacheInstance = new \think\cache\driver\Memcached();
$this->_cacheInstance = new \think\cache\driver\Memcached(['length' => 3]);
}
return $this->_cacheInstance;
}

View File

@@ -31,7 +31,7 @@ class redisTest extends cacheTestCase
protected function getCacheInstance()
{
if (null === $this->_cacheInstance) {
$this->_cacheInstance = new \think\cache\driver\Redis();
$this->_cacheInstance = new \think\cache\driver\Redis(['length' => 3]);
}
return $this->_cacheInstance;
}