function its_get_returns_true_if_the_trackID_is_registered($listener, $tracked) { MFS::mkdir($path = MFS::$tmpDir . '/path'); $id = PathUtil::createPathID($path); $tracked->getID()->shouldBeCalled()->willReturn($id); $this->add($tracked); $this->get($id)->shouldReturn($tracked); }
function it_should_listen_to_filesystem_update_event(Listener $listener) { $newFile = MFS::$tmpDir . '/update.txt'; MFS::cleanDir(MFS::$tmpDir); MFS::mkdir(MFS::$tmpDir); touch($newFile); $listener->getPaths()->shouldBeCalled()->willReturn(array(MFS::$tmpDir)); $listener->hasPath(Argument::any())->shouldBeCalled()->willReturn(true); $this->beConstructedWith(null); $this->initialize($listener); file_put_contents($newFile, 'Hello WOrld', LOCK_EX); $this->evaluate(); $this->getChangeSet()->shouldHaveCount(1); }
function letgo() { MFS::cleanDir(MFS::$tmpDir); }
function its_hasPath_should_check_against_pattern() { mfs::mkdir($dir = mfs::$tmpDir . '/root/subdir'); $this->to(mfs::$tmpDir . '/root'); touch($fphp = $dir . '/foobar.php'); touch($ftxt = $dir . '/foobar.txt'); $this->patterns('#.*\\.php$#'); $this->hasPath($fphp)->shouldReturn(true); $this->hasPath($ftxt)->shouldReturn(false); $this->patterns('#^subdir\\/.*\\.txt$#'); $this->hasPath($fphp)->shouldReturn(true); $this->hasPath($ftxt)->shouldReturn(true); }