HummingBirdAnimeClient/tests/Ion/Cache/Driver/CacheDriverBase.php

41 lines
800 B
PHP
Raw Normal View History

2016-04-07 12:34:57 -04:00
<?php
trait CacheDriverBase {
protected $foo = [
'bar' => [
'baz' => 'foobar'
]
];
protected $bar = 'secondvalue';
public function testHasCacheDriver()
{
$this->assertTrue((bool) $this->driver);
}
public function testDriverGetSet()
{
$this->driver->set('foo', $this->foo);
$this->assertEquals($this->driver->get('foo'), $this->foo);
}
public function testInvalidate()
{
$this->driver->set('foo', $this->foo);
$this->driver->invalidate('foo');
$this->assertEmpty($this->driver->get('foo'));
}
public function testInvalidateAll()
{
$this->driver->set('foo', $this->foo);
$this->driver->set('bar', $this->bar);
$this->driver->invalidateAll();
$this->assertEmpty($this->driver->get('foo'));
$this->assertEmpty($this->driver->get('bar'));
}
}