Exemple #1
0
/**
 * Return composer root directory
 * @return string Full path
 */
function get_composerroot_dir()
{
    return get_mahararoot_dir() . '/external';
}
 /**
  * Behat config file specifing the main context class,
  * the required Behat extensions and Mahara test wwwroot.
  *
  * @param array $features The system feature files
  * @param array $stepsdefinitions The system steps definitions
  * @return string
  */
 protected static function get_config_file_contents($features, $stepsdefinitions)
 {
     global $CFG;
     // We require here when we are sure behat dependencies are available.
     require_once $CFG->docroot . '../external/vendor/autoload.php';
     // It is possible that it has no value as we don't require a full behat setup to list the step definitions.
     if (empty($CFG->behat_wwwroot)) {
         $CFG->behat_wwwroot = 'http://example.com';
     }
     $basedir = $CFG->docroot . 'testing' . DIRECTORY_SEPARATOR . 'frameworks' . DIRECTORY_SEPARATOR . 'behat';
     $config = array('default' => array('paths' => array('features' => $basedir . DIRECTORY_SEPARATOR . 'features', 'bootstrap' => $basedir . DIRECTORY_SEPARATOR . 'features' . DIRECTORY_SEPARATOR . 'bootstrap'), 'context' => array('class' => 'BehatMaharaInitContext'), 'extensions' => array('Behat\\MinkExtension\\Extension' => array('base_url' => $CFG->behat_wwwroot, 'files_path' => get_mahararoot_dir() . '/test/behat/upload_files', 'goutte' => null, 'selenium2' => null), $basedir . DIRECTORY_SEPARATOR . 'features' . DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR . 'MaharaExtension.php' => array('formatters' => array('mahara_progress' => 'MaharaProgressFormatter'), 'features' => $features, 'steps_definitions' => $stepsdefinitions)), 'formatter' => array('name' => 'mahara_progress')));
     // In case user defined overrides respect them over our default ones.
     if (!empty($CFG->behat_config)) {
         $config = self::merge_config($config, $CFG->behat_config);
     }
     return Symfony\Component\Yaml\Yaml::dump($config, 10, 2);
 }