Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 28... Línea 28...
28
 * @package    qbank_comment
28
 * @package    qbank_comment
29
 * @copyright  2021 Catalyst IT Australia Pty Ltd
29
 * @copyright  2021 Catalyst IT Australia Pty Ltd
30
 * @author     Matt Porritt <mattp@catalyst-au.net>
30
 * @author     Matt Porritt <mattp@catalyst-au.net>
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32
 */
32
 */
33
class lib_test extends \advanced_testcase {
33
final class lib_test extends \advanced_testcase {
Línea 34... Línea 34...
34
 
34
 
35
    /**
35
    /**
36
     * Test the comment validation callback.
36
     * Test the comment validation callback.
37
     */
37
     */
Línea 82... Línea 82...
82
 
82
 
83
        // Make a test question.
83
        // Make a test question.
84
        $category = $this->getDataGenerator()->create_category();
84
        $category = $this->getDataGenerator()->create_category();
85
        $course = $this->getDataGenerator()->create_course(['category' => $category->id]);
85
        $course = $this->getDataGenerator()->create_course(['category' => $category->id]);
-
 
86
        $qgen = $this->getDataGenerator()->get_plugin_generator('core_question');
86
        $qgen = $this->getDataGenerator()->get_plugin_generator('core_question');
87
        $qbank = self::getDataGenerator()->create_module('qbank', ['course' => $course->id]);
87
        $context = \context_coursecat::instance($category->id);
88
        $context = \context_module::instance($qbank->cmid);
88
        $qcat = $qgen->create_question_category(['contextid' => $context->id]);
89
        $qcat = $qgen->create_question_category(['contextid' => $context->id]);
Línea 89... Línea 90...
89
        $question = $qgen->create_question('shortanswer', null, ['category' => $qcat->id, 'idnumber' => 'q1']);
90
        $question = $qgen->create_question('shortanswer', null, ['category' => $qcat->id, 'idnumber' => 'q1']);
Línea 109... Línea 110...
109
        $PAGE->set_url('/');
110
        $PAGE->set_url('/');
Línea 110... Línea 111...
110
 
111
 
111
        // Make a test question.
112
        // Make a test question.
112
        $category = $this->getDataGenerator()->create_category();
113
        $category = $this->getDataGenerator()->create_category();
-
 
114
        $course = $this->getDataGenerator()->create_course(['category' => $category->id]);
-
 
115
        $qbank = self::getDataGenerator()->create_module('qbank', ['course' => $course->id]);
113
        $course = $this->getDataGenerator()->create_course(['category' => $category->id]);
116
        $context = \context_module::instance($qbank->cmid);
114
        $qgen = $this->getDataGenerator()->get_plugin_generator('core_question');
-
 
115
        $context = \context_coursecat::instance($category->id);
117
        $qgen = $this->getDataGenerator()->get_plugin_generator('core_question');
116
        $qcat = $qgen->create_question_category(['contextid' => $context->id]);
118
        $qcat = $qgen->create_question_category(['contextid' => $context->id]);
117
        $question = $qgen->create_question('shortanswer', null, ['category' => $qcat->id, 'idnumber' => 'q1']);
119
        $question = $qgen->create_question('shortanswer', null, ['category' => $qcat->id, 'idnumber' => 'q1']);
118
        $args = [
120
        $args = [
119
            'questionid' => $question->id,
121
            'questionid' => $question->id,