示例#1
0
 function it_allows_to_write($crontab)
 {
     $processBuilder = new FakeProcessBuilder();
     $shouldBe = $this->defaultContent;
     $processBuilder->addCommand("'crontab' '(/var)?/tmp/.*'", function ($command) use($shouldBe) {
         if (preg_match("#'crontab' '((/var)?/tmp/.*)'#", $command, $matches)) {
             $content = file_get_contents($matches[1]);
             if ($content !== $shouldBe) {
                 throw new FailureException("Content in not correct");
             }
         }
     }, 1);
     Unix::setProcessBuilder($processBuilder);
     $this->write($crontab)->shouldReturn(true);
     Unix::setProcessBuilder(null);
 }
示例#2
0
 /**
  * @Given The process builder is fake
  *
  * @SuppressWarnings(PHPMD.StaticAccess)
  */
 public function theProcessBuilderIsFake()
 {
     $this->processBuilder = new FakeProcessBuilder();
     Unix::setProcessBuilder($this->processBuilder);
 }