Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 42... Línea 42...
42
 * @covers \question_edit_form
42
 * @covers \question_edit_form
43
 * @covers \qtype_calculated_edit_form
43
 * @covers \qtype_calculated_edit_form
44
 * @covers \qtype_calculatedsimple_edit_form
44
 * @covers \qtype_calculatedsimple_edit_form
45
 *
45
 *
46
 */
46
 */
47
class question_type_test extends \advanced_testcase {
47
final class question_type_test extends \advanced_testcase {
48
    protected $qtype;
48
    protected $qtype;
Línea 49... Línea 49...
49
 
49
 
-
 
50
    protected function setUp(): void {
50
    protected function setUp(): void {
51
        parent::setUp();
51
        $this->qtype = new qtype_calculatedsimple();
52
        $this->qtype = new qtype_calculatedsimple();
Línea 52... Línea 53...
52
    }
53
    }
53
 
54
 
-
 
55
    protected function tearDown(): void {
54
    protected function tearDown(): void {
56
        $this->qtype = null;
Línea 55... Línea 57...
55
        $this->qtype = null;
57
        parent::tearDown();
56
    }
58
    }
57
 
59
 
Línea 86... Línea 88...
86
        $returnedfromsave = $this->qtype->save_question($questiondata, $fromform);
88
        $returnedfromsave = $this->qtype->save_question($questiondata, $fromform);
87
        $actualquestionsdata = question_load_questions(array($returnedfromsave->id));
89
        $actualquestionsdata = question_load_questions(array($returnedfromsave->id));
88
        $actualquestiondata = end($actualquestionsdata);
90
        $actualquestiondata = end($actualquestionsdata);
Línea 89... Línea 91...
89
 
91
 
90
        foreach ($questiondata as $property => $value) {
92
        foreach ($questiondata as $property => $value) {
91
            if (!in_array($property, array('id', 'timemodified', 'timecreated', 'options', 'idnumber'))) {
93
            if (!in_array($property, ['id', 'timemodified', 'timecreated', 'options', 'idnumber', 'hints'])) {
92
                $this->assertEquals($value, $actualquestiondata->$property);
94
                $this->assertEquals($value, $actualquestiondata->$property);
93
            }
95
            }
Línea 94... Línea 96...
94
        }
96
        }
Línea 106... Línea 108...
106
                    $this->assertEquals($ansvalue, $actualanswer->$ansproperty);
108
                    $this->assertEquals($ansvalue, $actualanswer->$ansproperty);
107
                }
109
                }
108
            }
110
            }
109
        }
111
        }
Línea -... Línea 112...
-
 
112
 
-
 
113
        $this->assertCount(1, $actualquestiondata->hints);
-
 
114
        $hint = array_pop($actualquestiondata->hints);
-
 
115
        $this->assertEquals($formdata->hint[0]['text'], $hint->hint);
-
 
116
        $this->assertEquals($formdata->hint[0]['format'], $hint->hintformat);
110
 
117
 
Línea 111... Línea 118...
111
        $datasetloader = new qtype_calculated_dataset_loader($actualquestiondata->id);
118
        $datasetloader = new qtype_calculated_dataset_loader($actualquestiondata->id);
Línea 112... Línea 119...
112
 
119