Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 35... Línea 35...
35
 *
35
 *
36
 * @package   qtype_match
36
 * @package   qtype_match
37
 * @copyright 2009 The Open University
37
 * @copyright 2009 The Open University
38
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
39
 */
39
 */
40
class question_type_test extends \advanced_testcase {
40
final class question_type_test extends \advanced_testcase {
41
    /** @var qtype_match instance of the question type class to test. */
41
    /** @var qtype_match instance of the question type class to test. */
42
    protected $qtype;
42
    protected $qtype;
Línea 43... Línea 43...
43
 
43
 
-
 
44
    protected function setUp(): void {
44
    protected function setUp(): void {
45
        parent::setUp();
45
        $this->qtype = new qtype_match();
46
        $this->qtype = new qtype_match();
Línea 46... Línea 47...
46
    }
47
    }
47
 
48
 
-
 
49
    protected function tearDown(): void {
48
    protected function tearDown(): void {
50
        $this->qtype = null;
Línea 49... Línea 51...
49
        $this->qtype = null;
51
        parent::tearDown();
50
    }
52
    }
51
 
53
 
Línea 186... Línea 188...
186
        $actualquestionsdata = question_load_questions([$returnedfromsave->id], 'qbe.idnumber');
188
        $actualquestionsdata = question_load_questions([$returnedfromsave->id], 'qbe.idnumber');
187
        $actualquestiondata = end($actualquestionsdata);
189
        $actualquestiondata = end($actualquestionsdata);
Línea 188... Línea 190...
188
 
190
 
189
        foreach ($questiondata as $property => $value) {
191
        foreach ($questiondata as $property => $value) {
190
            if (!in_array($property, ['id', 'timemodified', 'timecreated', 'options', 'stamp',
192
            if (!in_array($property, ['id', 'timemodified', 'timecreated', 'options', 'stamp',
191
                'versionid', 'questionbankentryid'])) {
193
                'versionid', 'questionbankentryid', 'hints'])) {
192
                if (!empty($actualquestiondata)) {
194
                if (!empty($actualquestiondata)) {
193
                    $this->assertEquals($value, $actualquestiondata->$property);
195
                    $this->assertEquals($value, $actualquestiondata->$property);
194
                }
196
                }
195
            }
197
            }
Línea 199... Línea 201...
199
            if ($optionname != 'subquestions') {
201
            if ($optionname != 'subquestions') {
200
                $this->assertEquals($value, $actualquestiondata->options->$optionname);
202
                $this->assertEquals($value, $actualquestiondata->options->$optionname);
201
            }
203
            }
202
        }
204
        }
Línea -... Línea 205...
-
 
205
 
-
 
206
        $this->assertCount(1, $actualquestiondata->hints);
-
 
207
        $hint = array_pop($actualquestiondata->hints);
-
 
208
        $this->assertEquals($formdata->hint[0]['text'], $hint->hint);
-
 
209
        $this->assertEquals($formdata->hint[0]['format'], $hint->hintformat);
203
 
210
 
Línea 204... Línea 211...
204
        $this->assertObjectHasProperty('subquestions', $actualquestiondata->options);
211
        $this->assertObjectHasProperty('subquestions', $actualquestiondata->options);
205
 
212
 
206
        $subqpropstoignore = array('id');
213
        $subqpropstoignore = array('id');