mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 01:20:08 +08:00
47 lines
905 B
PHP
47 lines
905 B
PHP
<?php
|
|
|
|
use Flintstone\Cache\ArrayCache;
|
|
|
|
class ArrayCacheTest extends \PHPUnit\Framework\TestCase
|
|
{
|
|
/**
|
|
* @var ArrayCache
|
|
*/
|
|
private $cache;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
$this->cache = new ArrayCache();
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function canGetAndSet()
|
|
{
|
|
$this->cache->set('foo', 'bar');
|
|
$this->assertTrue($this->cache->contains('foo'));
|
|
$this->assertEquals('bar', $this->cache->get('foo'));
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function canDelete()
|
|
{
|
|
$this->cache->set('foo', 'bar');
|
|
$this->cache->delete('foo');
|
|
$this->assertFalse($this->cache->contains('foo'));
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function canFlush()
|
|
{
|
|
$this->cache->set('foo', 'bar');
|
|
$this->cache->flush();
|
|
$this->assertFalse($this->cache->contains('foo'));
|
|
}
|
|
}
|