public function testClear() { $item = new Item(); $poolStub = new PoolGetDriverStub(); $poolStub->setDriver(new DriverExceptionStub()); $item->setPool($poolStub); $item->setKey(array('path', 'to', 'clear')); $this->assertFalse($item->isDisabled()); $this->assertFalse($item->clear()); $this->assertTrue($item->isDisabled(), 'Is disabled after exception is thrown in driver'); }
private function assertDisabledStash(Item $stash) { $this->assertFalse($stash->set('true'), 'storeData returns false for disabled cache'); $this->assertNull($stash->get(), 'getData returns null for disabled cache'); $this->assertFalse($stash->clear(), 'clear returns false for disabled cache'); $this->assertTrue($stash->isMiss(), 'isMiss returns true for disabled cache'); $this->assertFalse($stash->extendCache(), 'extendCache returns false for disabled cache'); $this->assertTrue($stash->lock(100), 'lock returns true for disabled cache'); }