private function getExistingAdapterMock() { $existingAdapterMock = $this->prophesize(AdapterInterface::class); $existingAdapterMock->exists(Argument::type(IdentifierInterface::class))->willReturn(true); $existingAdapterMock->get(Argument::type(IdentifierInterface::class))->willReturn($this->blockMock->reveal()); return $existingAdapterMock; }
/** * @inheritDoc */ public function validate(BlockInterface $block) { $now = new \DateTime(); $updatedAt = $block->getUpdatedAt(); $interval = $updatedAt->diff($now); $diffInSeconds = $this->intervalToSeconds($interval); return $this->expire > $diffInSeconds; }
/** * @inheritDoc */ public function remove(BlockInterface $block) { if (!$this->exists($block->getIdentifier())) { return false; } $filename = $this->getFilename($block->getIdentifier()); if (false === unlink($filename)) { throw new \Exception('Unlink failed'); } return true; }