Example #1
0
 public function testCheckAndSetItem()
 {
     $this->assertTrue($this->_storage->setItem('key', 'value'));
     $success = null;
     $casToken = null;
     $this->assertEquals('value', $this->_storage->getItem('key', $success, $casToken));
     $this->assertNotNull($casToken);
     $this->assertTrue($this->_storage->checkAndSetItem($casToken, 'key', 'newValue'));
     $this->assertFalse($this->_storage->checkAndSetItem($casToken, 'key', 'failedValue'));
     $this->assertEquals('newValue', $this->_storage->getItem('key'));
 }
 /**
  * @test
  */
 public function delegatesCheckAndSetItem()
 {
     $this->storage->checkAndSetItem('token', 'key', 'value')->willReturn(true);
     $return = $this->cache->checkAndSetItem('token', 'key', 'value');
     $this->assertTrue($return);
 }
 public function checkAndSetItem($token, $key, $value)
 {
     return $this->storage->checkAndSetItem($token, $key, $value);
 }