コード例 #1
0
ファイル: util.php プロジェクト: rboyatt/mahara
$options['config']->shortoptions = array('c');
$options['config']->description = 'Get behat YML config path';
$options['config']->required = false;
$options['config']->defaultvalue = false;
$settings = new stdClass();
$settings->options = $options;
$settings->info = 'CLI tool to manage Behat integration in Mahara';
$cli->setup($settings);
try {
    if ($cli->get_cli_param('install')) {
        BehatTestingUtil::install_site();
        cli::cli_exit("\nAcceptance test site is installed\n");
    } else {
        if ($cli->get_cli_param('drop')) {
            TestLock::acquire('behat');
            BehatTestingUtil::drop_site();
            cli::cli_exit("\nAcceptance tests site dropped\n");
        } else {
            if ($cli->get_cli_param('enable')) {
                BehatTestingUtil::start_test_mode();
                $runtestscommand = BehatCommand::get_behat_command(true) . ' --config ' . BehatConfigManager::get_behat_cli_config_filepath();
                cli::cli_exit("\nAcceptance tests environment enabled on {$CFG->behat_wwwroot}, to run the tests use:\n " . $runtestscommand . "\n");
            } else {
                if ($cli->get_cli_param('disable')) {
                    BehatTestingUtil::stop_test_mode();
                    cli::cli_exit("\nAcceptance test site is disabled\n");
                } else {
                    if ($cli->get_cli_param('diag')) {
                        $code = BehatTestingUtil::get_behat_status();
                        exit($code);
                    } else {