Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 33... Línea 33...
33
 * @package   core_question
33
 * @package   core_question
34
 * @copyright 2012 The Open University
34
 * @copyright 2012 The Open University
35
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36
 */
36
 */
37
class questionusagebyactivity_data_test extends \data_loading_method_test_base {
37
class questionusagebyactivity_data_test extends \data_loading_method_test_base {
38
    public function test_load() {
38
    public function test_load(): void {
39
        $scid = \context_system::instance()->id;
39
        $scid = \context_system::instance()->id;
40
        $records = new question_test_recordset(array(
40
        $records = new question_test_recordset(array(
41
        array('qubaid', 'contextid', 'component', 'preferredbehaviour',
41
        array('qubaid', 'contextid', 'component', 'preferredbehaviour',
42
                                               'questionattemptid', 'questionusageid', 'slot',
42
                                               'questionattemptid', 'questionusageid', 'slot',
43
                                                              'behaviour', 'questionid', 'variant', 'maxmark', 'minfraction', 'maxfraction', 'flagged',
43
                                                              'behaviour', 'questionid', 'variant', 'maxmark', 'minfraction', 'maxfraction', 'flagged',
Línea 88... Línea 88...
88
        $this->assertEquals(1256233720, $step->get_timecreated());
88
        $this->assertEquals(1256233720, $step->get_timecreated());
89
        $this->assertEquals(1, $step->get_user_id());
89
        $this->assertEquals(1, $step->get_user_id());
90
        $this->assertEquals(array('-finish' => '1'), $step->get_all_data());
90
        $this->assertEquals(array('-finish' => '1'), $step->get_all_data());
91
    }
91
    }
Línea 92... Línea 92...
92
 
92
 
93
    public function test_load_data_no_steps() {
93
    public function test_load_data_no_steps(): void {
94
        // The code had a bug where if one question_attempt had no steps,
94
        // The code had a bug where if one question_attempt had no steps,
95
        // load_from_records got stuck in an infinite loop. This test is to
95
        // load_from_records got stuck in an infinite loop. This test is to
96
        // verify that no longer happens.
96
        // verify that no longer happens.
97
        $scid = \context_system::instance()->id;
97
        $scid = \context_system::instance()->id;
Línea 120... Línea 120...
120
 
120
 
121
        $qa = $quba->get_question_attempt(1);
121
        $qa = $quba->get_question_attempt(1);
122
        $this->assertEquals(0, $qa->get_num_steps());
122
        $this->assertEquals(0, $qa->get_num_steps());
Línea 123... Línea 123...
123
    }
123
    }
124
 
124
 
125
    public function test_load_data_no_qas() {
125
    public function test_load_data_no_qas(): void {
126
        // The code had a bug where if a question_usage had no question_attempts,
126
        // The code had a bug where if a question_usage had no question_attempts,
127
        // load_from_records got stuck in an infinite loop. This test is to
127
        // load_from_records got stuck in an infinite loop. This test is to
128
        // verify that no longer happens.
128
        // verify that no longer happens.