2016-04-12 14:05:13 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Aviat\Ion\Friend;
|
|
|
|
use Aviat\Ion\Cache\CacheManager;
|
|
|
|
|
|
|
|
class CacheManagerText extends AnimeClient_TestCase {
|
|
|
|
|
|
|
|
protected $cachedTime;
|
|
|
|
|
|
|
|
public function __call($name, $args)
|
|
|
|
{
|
|
|
|
return call_user_func_array($name, $args);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
2016-07-27 13:18:52 -04:00
|
|
|
$this->cache = new CacheManager($this->container->get('config'), $this->container);
|
2016-04-12 14:05:13 -04:00
|
|
|
$this->friend = new Friend($this->cache);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGet()
|
|
|
|
{
|
|
|
|
$this->cachedTime = $this->cache->get($this, 'time');
|
|
|
|
$this->assertEquals($this->cache->get($this, 'time'), $this->cachedTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetFresh()
|
|
|
|
{
|
|
|
|
$this->assertNotEquals($this->cache->getFresh($this, 'time'), $this->cachedTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testPurge()
|
|
|
|
{
|
|
|
|
$this->cachedTime = $this->cache->get($this, 'time');
|
|
|
|
$key = $this->friend->generateHashForMethod($this, 'time', []);
|
|
|
|
$this->cache->purge();
|
|
|
|
$this->assertEmpty($this->friend->driver->get($key));
|
|
|
|
}
|
|
|
|
}
|