Пример #1
0
 /**
  * Test plan form definition.
  *
  * @return void
  */
 public function definition()
 {
     $mform = $this->_form;
     $mform->addElement('select', 'size', get_string('size', 'tool_generator'), tool_generator_testplan_backend::get_size_choices());
     $mform->setDefault('size', tool_generator_testplan_backend::DEFAULT_SIZE);
     $mform->addElement('select', 'courseid', get_string('targetcourse', 'tool_generator'), tool_generator_testplan_backend::get_course_options());
     $mform->addElement('advcheckbox', 'updateuserspassword', get_string('updateuserspassword', 'tool_generator'));
     $mform->addHelpButton('updateuserspassword', 'updateuserspassword', 'tool_generator');
     $mform->addElement('submit', 'submit', get_string('createtestplan', 'tool_generator'));
 }
Пример #2
0
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * CLI interface for creating a test plan
 *
 * @package tool_generator
 * @copyright 2013 David Monllaó
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define('CLI_SCRIPT', true);
define('NO_OUTPUT_BUFFERING', true);
require dirname(__FILE__) . '/../../../../config.php';
require_once $CFG->libdir . '/clilib.php';
require_once $CFG->dirroot . '/' . $CFG->admin . '/tool/generator/classes/testplan_backend.php';
// CLI options.
list($options, $unrecognized) = cli_get_params(array('help' => false, 'shortname' => false, 'size' => false, 'bypasscheck' => false, 'updateuserspassword' => false), array('h' => 'help'));
$testplansizes = '* ' . implode(PHP_EOL . '* ', tool_generator_testplan_backend::get_size_choices());
// Display help.
if (!empty($options['help']) || empty($options['shortname']) || empty($options['size'])) {
    echo get_string('testplanexplanation', 'tool_generator', tool_generator_testplan_backend::get_repourl()) . "Options:\n-h, --help              Print out this help\n--shortname             Shortname of the test plan's target course (required)\n--size                  Size of the test plan to create XS, S, M, L, XL, or XXL (required)\n--bypasscheck           Bypasses the developer-mode check (be careful!)\n--updateuserspassword   Updates the target course users password according to \$CFG->tool_generator_users_password\n\n{$testplansizes}\n\nConsider that, the server resources you will need to run the test plan will be higher as the test plan size is higher.\n\nExample from Moodle root directory:\n\$sudo -u www-data /usr/bin/php admin/tool/generator/cli/maketestplan.php --shortname=\"testcourse_12\" --size=S\n";
    // Exit with error unless we're showing this because they asked for it.
    exit(empty($options['help']) ? 1 : 0);
}
// Check debugging is set to developer level.
if (empty($options['bypasscheck']) && !debugging('', DEBUG_DEVELOPER)) {
    cli_error(get_string('error_notdebugging', 'tool_generator'));
}
// Get options.
$shortname = $options['shortname'];
$sizename = $options['size'];
// Check size.
try {