function its_checkPath_should_track_on_filesystem_modify_event(ResourceInterface $resource, TrackedObject $tracked) { $tracked->getResource()->willReturn($resource); $tracked->getID()->willReturn(PathUtil::createPathID($this->testFile)); $tracked->getChecksum()->willReturn('old_checksum'); $tracked->setChecksum('new_checksum')->shouldBeCalled(); $resource->isExists()->shouldBeCalled()->willReturn(true); $resource->getChecksum()->shouldBeCalled()->willReturn('new_checksum'); $this->checkPath($this->testFile); $this->getChangeSet()->shouldHaveCount(1); }
/** * Create new TrackedObject * * @param ResourceInterface $resource * @return TrackedObject */ public function createTrackedObject(ResourceInterface $resource) { $tracked = new TrackedObject(); $tracked->setResource($resource); $tracked->setChecksum($resource->getChecksum()); if (is_null($tracked->getID())) { $tracked->setID(PathUtil::createPathID($resource->getResource())); } return $tracked; }
public function unwatch(TrackedObject $tracked) { if ($tracked->getResource()->isExists()) { return; } @inotify_rm_watch($this->inotify, $tracked->getID()); unset($this->inotifyMap[$tracked->getID()]); return parent::unwatch($tracked); }