/** * Execute behat command for featurename and return exit status. * * @param string $featurename name of the feature * @param string $featurepath path of feature file * @return int status code. */ protected function execute_behat_generator($featurename, $featurepath) { $cmd = "vendor/bin/behat --config " . util::get_tool_dir() . DIRECTORY_SEPARATOR . 'behat.yml ' . $featurepath; $process = new symfonyprocess($cmd); $process->setWorkingDirectory(__DIR__ . "/../../moodle"); $process->setTimeout(null); $process->start(); if ($process->getStatus() !== 'started') { echo "Error starting process: {$featurename}"; $process->signal(SIGKILL); exit(1); } while ($process->isRunning()) { $output = $process->getIncrementalOutput(); // Don't show start data everytime. $output = preg_replace('/[a-z0-9.\\(\\)].*/im', '', $output); $op = trim($output); if (!empty($op)) { echo $output; } } return $process->getExitCode(); }
/** * Execute behat command for featurename and return exit status. * * @return int status code. */ protected function execute_behat_generator() { $cmd = "vendor/bin/behat --config " . util::get_tool_dir() . DIRECTORY_SEPARATOR . 'behat.yml '; $process = new Process($cmd); $process->setWorkingDirectory(__DIR__ . "/../../../../../"); $process->setTimeout(null); $process->start(); if ($process->getStatus() !== 'started') { echo "Error starting process"; $process->signal(SIGKILL); exit(1); } while ($process->isRunning()) { $output = $process->getIncrementalOutput(); $op = trim($output); if (!empty($op)) { echo $output; } } if ($process->getExitCode() !== 0) { echo $process->getErrorOutput(); } return $process->getExitCode(); }