Exemplo n.º 1
0
 /**
  * @test
  * @covers Cocur\Watchman\Watch::__construct()
  * @covers Cocur\Watchman\Watch::getRoot()
  */
 public function getRoot()
 {
     $this->assertEquals($this->root, $this->watch->getRoot());
 }
Exemplo n.º 2
0
 /**
  * Executes the `trigger` command.
  * @param Watch|string $watch     Watch object or path to root.
  * @param string       $name      Trigger name
  * @param string       $patterns  Patterns
  * @param string       $command   Command to execute
  *
  * @return string Name of the added trigger.
  *
  * @throws \RuntimeException if the trigger could not be created.
  */
 public function addTrigger($watch, $name, $patterns, $command)
 {
     if ($watch instanceof Watch) {
         $root = $watch->getRoot();
     } else {
         $root = $watch;
         $watch = new Watch($this, $root);
     }
     $process = $this->processFactory->create(sprintf('%s -- trigger %s %s %s -- %s', $this->binary, $root, $name, $patterns, $command));
     return new Trigger($watch, $this->runProcess($process)['triggerid']);
 }