/** * Create a question. * * Creating questions relies on the question/type/.../tests/helper.php mechanism. * We start with test_question_maker::get_question_form_data($data['qtype'], $data['template']) * and then overlay the values from any other fields of $data that are set. * * @param array $data the row of data from the behat script. */ protected function process_question($data) { if (array_key_exists('questiontext', $data)) { $data['questiontext'] = array('text' => $data['questiontext'], 'format' => FORMAT_HTML); } if (array_key_exists('generalfeedback', $data)) { $data['generalfeedback'] = array('text' => $data['generalfeedback'], 'format' => FORMAT_HTML); } $which = null; if (!empty($data['template'])) { $which = $data['template']; } $this->datagenerator->get_plugin_generator('core_question')->create_question($data['qtype'], $which, $data); }