Beispiel #1
0
 public function testHasItemCallsInternalHasItem()
 {
     $this->_storage = $this->getMockForAbstractAdapter(array('internalHasItem'));
     $key = 'key1';
     $result = true;
     $this->_storage->expects($this->once())->method('internalHasItem')->with($this->equalTo($key))->will($this->returnValue($result));
     $rs = $this->_storage->hasItem($key);
     $this->assertSame($result, $rs);
 }
 public function testInternalHasItemCallsInternalGetItemReturnsFalseOnItemNotFoundException()
 {
     $this->_storage = $this->getMockForAbstractAdapter(array('internalGetItem'));
     $options = array('ttl' => 123);
     $key = 'key1';
     $this->_storage->expects($this->once())->method('internalGetItem')->with($this->equalTo($key), $this->equalTo($this->normalizeOptions($options)))->will($this->throwException(new Exception\ItemNotFoundException()));
     // throw ItemNotFoundException
     $rs = $this->_storage->hasItem($key, $options);
     $this->assertFalse($rs);
 }
 public function testHasItem()
 {
     $this->_storage->expects($this->at(0))->method('getItem')->with($this->equalTo('key'))->will($this->returnValue('value'));
     $this->assertTrue($this->_storage->hasItem('key'));
 }