Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 50... Línea 50...
50
        $this->question->defaultmark = 3;
50
        $this->question->defaultmark = 3;
51
        $this->usageid = 13;
51
        $this->usageid = 13;
52
        $this->qa = new question_attempt($this->question, $this->usageid);
52
        $this->qa = new question_attempt($this->question, $this->usageid);
53
    }
53
    }
Línea 54... Línea 54...
54
 
54
 
55
    public function test_constructor_sets_maxmark() {
55
    public function test_constructor_sets_maxmark(): void {
56
        $qa = new question_attempt($this->question, $this->usageid);
56
        $qa = new question_attempt($this->question, $this->usageid);
57
        $this->assertSame($this->question, $qa->get_question(false));
57
        $this->assertSame($this->question, $qa->get_question(false));
58
        $this->assertEquals(3, $qa->get_max_mark());
58
        $this->assertEquals(3, $qa->get_max_mark());
Línea 59... Línea 59...
59
    }
59
    }
60
 
60
 
61
    public function test_maxmark_beats_default_mark() {
61
    public function test_maxmark_beats_default_mark(): void {
62
        $qa = new question_attempt($this->question, $this->usageid, null, 2);
62
        $qa = new question_attempt($this->question, $this->usageid, null, 2);
Línea 63... Línea 63...
63
        $this->assertEquals(2, $qa->get_max_mark());
63
        $this->assertEquals(2, $qa->get_max_mark());
64
    }
64
    }
65
 
65
 
66
    public function test_get_set_slot() {
66
    public function test_get_set_slot(): void {
Línea 67... Línea 67...
67
        $this->qa->set_slot(7);
67
        $this->qa->set_slot(7);
68
        $this->assertEquals(7, $this->qa->get_slot());
68
        $this->assertEquals(7, $this->qa->get_slot());
69
    }
69
    }
Línea 70... Línea 70...
70
 
70
 
71
    public function test_fagged_initially_false() {
71
    public function test_fagged_initially_false(): void {
72
        $this->assertEquals(false, $this->qa->is_flagged());
72
        $this->assertEquals(false, $this->qa->is_flagged());
73
    }
73
    }
Línea 74... Línea 74...
74
 
74
 
75
    public function test_set_is_flagged() {
75
    public function test_set_is_flagged(): void {
76
        $this->qa->set_flagged(true);
76
        $this->qa->set_flagged(true);
77
        $this->assertEquals(true, $this->qa->is_flagged());
77
        $this->assertEquals(true, $this->qa->is_flagged());
78
    }
78
    }
Línea 79... Línea 79...
79
 
79
 
80
    public function test_get_qt_field_name() {
80
    public function test_get_qt_field_name(): void {
81
        $name = $this->qa->get_qt_field_name('test');
81
        $name = $this->qa->get_qt_field_name('test');
82
        $this->assertMatchesRegularExpression('/^' . preg_quote($this->qa->get_field_prefix(), '/') . '/', $name);
82
        $this->assertMatchesRegularExpression('/^' . preg_quote($this->qa->get_field_prefix(), '/') . '/', $name);
83
        $this->assertMatchesRegularExpression('/_test$/', $name);
83
        $this->assertMatchesRegularExpression('/_test$/', $name);
Línea 84... Línea 84...
84
    }
84
    }
85
 
85
 
86
    public function test_get_behaviour_field_name() {
86
    public function test_get_behaviour_field_name(): void {
87
        $name = $this->qa->get_behaviour_field_name('test');
87
        $name = $this->qa->get_behaviour_field_name('test');
88
        $this->assertMatchesRegularExpression('/^' . preg_quote($this->qa->get_field_prefix(), '/') . '/', $name);
88
        $this->assertMatchesRegularExpression('/^' . preg_quote($this->qa->get_field_prefix(), '/') . '/', $name);
89
        $this->assertMatchesRegularExpression('/_-test$/', $name);
89
        $this->assertMatchesRegularExpression('/_-test$/', $name);
Línea 90... Línea 90...
90
    }
90
    }
91
 
91
 
92
    public function test_get_field_prefix() {
92
    public function test_get_field_prefix(): void {
93
        $this->qa->set_slot(7);
93
        $this->qa->set_slot(7);
Línea 94... Línea 94...
94
        $name = $this->qa->get_field_prefix();
94
        $name = $this->qa->get_field_prefix();
95
        $this->assertMatchesRegularExpression('/' . preg_quote($this->usageid, '/') . '/', $name);
95
        $this->assertMatchesRegularExpression('/' . preg_quote($this->usageid, '/') . '/', $name);
96
        $this->assertMatchesRegularExpression('/' . preg_quote($this->qa->get_slot(), '/') . '/', $name);
96
        $this->assertMatchesRegularExpression('/' . preg_quote($this->qa->get_slot(), '/') . '/', $name);
97
    }
97
    }
98
 
98
 
99
    public function test_get_submitted_var_not_present_var_returns_null() {
99
    public function test_get_submitted_var_not_present_var_returns_null(): void {