コード例 #1
0
 /**
  * @test Functional
  */
 public function getReturnsPreviouslySetEntry()
 {
     $this->setUpBackend();
     $data = 'data';
     $identifier = 'identifier' . uniqid();
     $this->backend->set($identifier, $data);
     $fetchedData = $this->backend->get($identifier);
     $this->assertSame($data, $fetchedData);
 }
コード例 #2
0
 /**
  * @test
  */
 public function removeRemovesEntryFromCache()
 {
     for ($i = 0; $i < 10; $i++) {
         $this->backend->set('entry_' . $i, 'foo', array('tag1'));
     }
     $this->assertCount(10, $this->backend->findIdentifiersByTag('tag1'));
     $this->assertEquals('foo', $this->backend->get('entry_1'));
     $actualEntries = array();
     foreach ($this->backend as $key => $value) {
         $actualEntries[] = $key;
     }
     $this->assertCount(10, $actualEntries);
     $this->backend->remove('entry_3');
     $this->assertCount(9, $this->backend->findIdentifiersByTag('tag1'));
     $this->assertFalse($this->backend->get('entry_3'));
     $actualEntries = array();
     foreach ($this->backend as $key => $value) {
         $actualEntries[] = $key;
     }
     $this->assertCount(9, $actualEntries);
 }
コード例 #3
0
 /**
  * @test
  */
 public function getInvokesRedis()
 {
     $this->redis->expects($this->once())->method('get')->with('Foo_Cache:entry:foo')->will($this->returnValue('bar'));
     $this->assertEquals('bar', $this->backend->get('foo'));
 }