예제 #1
0
 public function prepare(BehatWrapper $behat, BehatCommand $command, $cwd = null)
 {
     // Build the command line options, flags, and arguments.
     $binary = ProcessUtils::escapeArgument($behat->getBehatBinary());
     $commandLine = rtrim($binary . ' ' . $command->getCommandLine());
     parent::__construct($commandLine, $cwd, null, null, $behat->getTimeout(), array());
 }
 public function run($path, $test_path)
 {
     $this->behatTestHelper->setBasePath($path);
     $yml_path = $this->behatTestHelper->getBehatYmlPath($path);
     $command = BehatCommand::getInstance()->setOption('config', $yml_path)->setFlag('no-paths')->setTestPath($test_path);
     return $this->behatWrapper->run($command);
 }
예제 #3
0
 public function testUnsetOption()
 {
     $behat = BehatCommand::getInstance()->setOption('format', 'pretty')->setFlag('version')->setTestPath($this->path);
     $behat->unsetOption('format');
     $expected = "--version {$this->path}";
     $commandLine = $behat->getCommandLine();
     $this->assertEquals($expected, $commandLine);
 }
예제 #4
0
 public function testEvent()
 {
     $process = new Process('');
     $command = BehatCommand::getInstance();
     $event = new BehatEvent($this->wrapper, $process, $command);
     $this->assertEquals($this->wrapper, $event->getWrapper());
     $this->assertEquals($process, $event->getProcess());
     $this->assertEquals($command, $event->getCommand());
 }
예제 #5
0
 public function testBehatRun()
 {
     $testpath = $this->testfilepath;
     $command = BehatCommand::getInstance();
     $command->setOption('config', $this->behatyml);
     $command->setTestPath($testpath);
     $output = $this->wrapper->run($command);
     $this->assertContains('5 passed', $output);
 }
예제 #6
0
 /**
  * Runs an arbitrary Behat command.
  *
  * The command is simply a raw command line entry for everything after the
  * Behat binary. For example, a `behat --version` command would be passed as
  * `version` via the first argument of this method.
  *
  * Note that no events are thrown by this method.
  *
  * @param string $commandLine
  *   The raw command containing the Behat options and arguments. The Behat
  *   binary should not be in the command, for example `behat --version` would
  *   translate to "--version".
  *
  * @param string $cwd
  *   The working path to the behat bin
  *
  * @return string
  *   The STDOUT returned by the Behat command.
  *
  * @throws \BehatWrapper\BehatException
  *
  * @see BehatWrapper::run()
  */
 public function behat($commandLine, $cwd = null)
 {
     $command = BehatCommand::getInstance($commandLine);
     $command->setDirectory($cwd);
     return $this->run($command);
 }