public function testPurge() { $pool = new Pool(); $pool->setDriver(new DriverExceptionStub()); $item = $pool->getItem('test'); $this->assertFalse($item->isDisabled()); $this->assertFalse($pool->purge()); $item = $pool->getItem('test'); $this->assertTrue($item->isDisabled(), 'Is disabled after exception is thrown in driver'); $this->assertFalse($pool->purge()); }
function setup_cache_mocks(Pool $cache) { $cache->setDriver(Argument::any())->willReturn(true); $item = $this->prophet->prophesize('Stash\\Item'); $item->get()->willReturn('data'); $item->set(Argument::cetera())->willReturn(true); $item->isMiss()->willReturn(true); $item->lock()->willReturn(true); $item->clear()->willReturn(true); $item = $item->reveal(); $cache->getItem(Argument::any())->willReturn($item); $cache->purge()->willReturn(true); $cache->flush()->willReturn(true); return ['cache' => $cache]; }