/** * Initializes checker. * * @param ResourceInterface $resource resource * @param integer $eventsMask event types bitmask */ public function __construct(ResourceInterface $resource, $eventsMask = FilesystemEvent::ALL) { $this->resource = $resource; $this->timestamp = $resource->getModificationTime() + 1; $this->eventsMask = $eventsMask; $this->deleted = !$resource->exists(); }
/** * Initializes tracked resource. * * @param string $trackingId id of the tracked resource * @param ResourceInterface $resource resource */ public function __construct($trackingId, ResourceInterface $resource) { if (!$resource->exists()) { throw new InvalidArgumentException(sprintf('Unable to track a non-existent resource (%s)', $resource)); } $this->trackingId = $trackingId; $this->resource = $resource; }
protected function touchResource(ResourceInterface $resource, $exists = true, $fresh = true) { if ($exists) { $resource->expects($this->any())->method('isFresh')->will($this->returnValue($fresh)); } else { $resource->expects($this->any())->method('exists')->will($this->returnValue(false)); } }