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); }
/** * 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) { $this->log('Unwatch tracked object', array('path' => realpath($tracked->getResource()), LogLevel::DEBUG)); }
function its_checkPath_should_track_on_filesystem_delete_event(AdapterInterface $adapter, FileResource $resource, TrackedObject $tracked) { $tracked->getResource()->shouldBeCalled()->willReturn($resource); $tracked->getChecksum()->shouldBeCalled()->willReturn('checksum'); $resource->isExists()->shouldBeCalled()->willReturn(false); $resource->getChecksum()->willReturn('new_checksum')->shouldBeCalled(); $resource->getResource()->willReturn($this->testFile); $adapter->unwatch($tracked)->shouldBeCalled(); $this->checkPath($this->testFile); $this->getChangeSet()->shouldHaveCount(1); }