41 lines
800 B
PHP
41 lines
800 B
PHP
<?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'));
|
|
}
|
|
} |