Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 62... Línea 62...
62
 *
62
 *
63
 * @package    qtype_gapselect
63
 * @package    qtype_gapselect
64
 * @copyright  2012 The Open University
64
 * @copyright  2012 The Open University
65
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
65
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
66
 */
66
 */
67
class edit_form_test extends \advanced_testcase {
67
final class edit_form_test extends \advanced_testcase {
Línea 68... Línea 68...
68
 
68
 
69
    /**
69
    /**
70
     * Helper method.
70
     * Helper method.
71
     *
71
     *
Línea 78... Línea 78...
78
     */
78
     */
79
    protected function get_form($classname) {
79
    protected function get_form($classname) {
80
        $this->setAdminUser();
80
        $this->setAdminUser();
81
        $this->resetAfterTest();
81
        $this->resetAfterTest();
Línea -... Línea 82...
-
 
82
 
-
 
83
        $course = self::getDataGenerator()->create_course();
82
 
84
        $qbank = self::getDataGenerator()->create_module('qbank', ['course' => $course->id]);
83
        $syscontext = \context_system::instance();
85
        $bankcontext = \context_module::instance($qbank->cmid);
84
        $category = question_make_default_categories(array($syscontext));
86
        $category = question_get_default_category($bankcontext->id, true);
85
        $fakequestion = new \stdClass();
87
        $fakequestion = new \stdClass();
86
        $fakequestion->qtype = 'gapselect'; // Does not actually matter if this is wrong.
88
        $fakequestion->qtype = 'gapselect'; // Does not actually matter if this is wrong.
87
        $fakequestion->contextid = $syscontext->id;
89
        $fakequestion->contextid = $bankcontext->id;
88
        $fakequestion->createdby = 2;
90
        $fakequestion->createdby = 2;
89
        $fakequestion->category = $category->id;
91
        $fakequestion->category = $category->id;
90
        $fakequestion->questiontext = 'Test [[1]] question [[2]]';
92
        $fakequestion->questiontext = 'Test [[1]] question [[2]]';
91
        $fakequestion->options = new \stdClass();
93
        $fakequestion->options = new \stdClass();
Línea 94... Línea 96...
94
        $fakequestion->formoptions->movecontext = null;
96
        $fakequestion->formoptions->movecontext = null;
95
        $fakequestion->formoptions->repeatelements = true;
97
        $fakequestion->formoptions->repeatelements = true;
96
        $fakequestion->inputs = null;
98
        $fakequestion->inputs = null;
Línea 97... Línea 99...
97
 
99
 
98
        $form = new $classname(new \moodle_url('/'), $fakequestion, $category,
100
        $form = new $classname(new \moodle_url('/'), $fakequestion, $category,
Línea 99... Línea 101...
99
                new \core_question\local\bank\question_edit_contexts($syscontext));
101
                new \core_question\local\bank\question_edit_contexts($bankcontext));
100
 
102
 
Línea 101... Línea 103...
101
        return [$form, $category];
103
        return [$form, $category];