コード例 #1
0
 /**
  * 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);
     $moodlepath = util::get_moodle_path();
     $process->setWorkingDirectory($moodlepath);
     $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();
 }
コード例 #2
0
 /**
  * Save state of current site. Dataroot and database.
  *
  * @param string $statename
  * @return int 0 on success else error code.
  */
 public static function store_site_state($statename = "default")
 {
     echo "Saving database state" . PHP_EOL;
     // Save database and dataroot state, before proceeding.
     self::store_database_state($statename);
     echo "Saving dataroot state" . PHP_EOL;
     self::store_data_root_state($statename);
     echo "Site state is stored at " . util::get_tool_dir() . DIRECTORY_SEPARATOR . $statename . ".*" . PHP_EOL;
     return 0;
 }