public function testSerializeUnserialize() { $expected = 'some other random value string not unsimilar to the last random value string'; $key = __METHOD__; $this->obj->set($key, $expected); $serialized = serialize($this->obj); $this->assertNotEmpty($serialized); /** * @var $unserialized RuntimeCache */ $unserialized = unserialize($serialized); $this->assertTrue($unserialized instanceof RuntimeCache); $this->assertEquals($expected, $unserialized->get($key)); }
public function testCacheCanBeCleared() { $this->cache->set('name 1', 'Marcos'); $this->cache->set('name 2', 'Marcos'); $this->cache->set('name 3', 'Marcos'); $this->assertEquals(3, count($this->cache)); $this->cache->clear(); $this->assertEquals(0, count($this->cache)); }
public function testValuesCanBeSetThenReadAndIsThenUnset() { $this->cache->set('name', 'Marcos'); $this->cache->get('name'); $this->assertFalse($this->cache->has('name')); }