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

45 lines
924 B
PHP
Raw Normal View History

<?php
2016-08-29 11:34:25 -04:00
namespace Aviat\Ion\Tests\Cache\Driver;
trait CacheDriverBase {
2016-08-29 11:34:25 -04:00
protected $foo = [
'bar' => [
'baz' => 'foobar'
]
];
2016-08-29 11:34:25 -04:00
protected $bar = 'secondvalue';
2016-08-29 11:34:25 -04:00
public function testHasCacheDriver()
{
$this->assertTrue((bool) $this->driver);
}
2016-08-29 11:34:25 -04:00
public function testDriverGetSet()
{
$this->driver->set('foo', $this->foo);
$this->driver->set('bar', 'baz');
$this->assertEquals($this->driver->get('foo'), $this->foo);
$this->assertEquals($this->driver->get('bar'), 'baz');
}
2016-08-29 11:34:25 -04:00
public function testInvalidate()
{
$this->driver->set('foo', $this->foo);
$this->driver->invalidate('foo');
$this->assertEmpty($this->driver->get('foo'));
}
2016-08-29 11:34:25 -04:00
public function testInvalidateAll()
{
$this->driver->set('foo', $this->foo);
$this->driver->set('bar', $this->bar);
2016-08-29 11:34:25 -04:00
$this->driver->invalidateAll();
2016-08-29 11:34:25 -04:00
$this->assertEmpty($this->driver->get('foo'));
$this->assertEmpty($this->driver->get('bar'));
}
}