コード例 #1
0
ファイル: Tracker.php プロジェクト: phpguard/listen
 /**
  * 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;
 }
コード例 #2
0
ファイル: TrackerSpec.php プロジェクト: phpguard/listen
 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);
 }