Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 34... Línea 34...
34
 *
34
 *
35
 * @copyright  2009 The Open University
35
 * @copyright  2009 The Open University
36
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37
 * @coversDefaultClass \question_engine
37
 * @coversDefaultClass \question_engine
38
 */
38
 */
39
class question_engine_test extends advanced_testcase {
39
final class question_engine_test extends advanced_testcase {
Línea 40... Línea 40...
40
 
40
 
41
    /**
41
    /**
42
     * Load required libraries.
42
     * Load required libraries.
43
     */
43
     */
44
    public static function setUpBeforeClass(): void {
44
    public static function setUpBeforeClass(): void {
Línea 45... Línea 45...
45
        global $CFG;
45
        global $CFG;
-
 
46
 
46
 
47
        require_once("{$CFG->dirroot}/question/engine/lib.php");
Línea 47... Línea 48...
47
        require_once("{$CFG->dirroot}/question/engine/lib.php");
48
        parent::setUpBeforeClass();
48
    }
49
    }
49
 
50
 
Línea 86... Línea 87...
86
    /**
87
    /**
87
     * Data provider for get_behaviour_unused_display_options.
88
     * Data provider for get_behaviour_unused_display_options.
88
     *
89
     *
89
     * @return array
90
     * @return array
90
     */
91
     */
91
    public function get_behaviour_unused_display_options_provider(): array {
92
    public static function get_behaviour_unused_display_options_provider(): array {
92
        return [
93
        return [
93
            'interactive' => [
94
            'interactive' => [
94
                'interactive',
95
                'interactive',
95
                [],
96
                [],
96
            ],
97
            ],
Línea 124... Línea 125...
124
    /**
125
    /**
125
     * Data provider for can_questions_finish_during_the_attempt_provider.
126
     * Data provider for can_questions_finish_during_the_attempt_provider.
126
     *
127
     *
127
     * @return array
128
     * @return array
128
     */
129
     */
129
    public function can_questions_finish_during_the_attempt_provider(): array {
130
    public static function can_questions_finish_during_the_attempt_provider(): array {
130
        return [
131
        return [
131
            ['deferredfeedback', false],
132
            ['deferredfeedback', false],
132
            ['interactive', true],
133
            ['interactive', true],
133
        ];
134
        ];
134
    }
135
    }
Línea 148... Línea 149...
148
    /**
149
    /**
149
     * Data provider for sort_behaviours.
150
     * Data provider for sort_behaviours.
150
     *
151
     *
151
     * @return array
152
     * @return array
152
     */
153
     */
153
    public function sort_behaviours_provider(): array {
154
    public static function sort_behaviours_provider(): array {
154
        $in = [
155
        $in = [
155
            'b1' => 'Behave 1',
156
            'b1' => 'Behave 1',
156
            'b2' => 'Behave 2',
157
            'b2' => 'Behave 2',
157
            'b3' => 'Behave 3',
158
            'b3' => 'Behave 3',
158
            'b4' => 'Behave 4',
159
            'b4' => 'Behave 4',
Línea 206... Línea 207...
206
     * Tests for is_manual_grade_in_range.
207
     * Tests for is_manual_grade_in_range.
207
     *
208
     *
208
     * @dataProvider is_manual_grade_in_range_provider
209
     * @dataProvider is_manual_grade_in_range_provider
209
     * @covers \question_engine::is_manual_grade_in_range
210
     * @covers \question_engine::is_manual_grade_in_range
210
     * @param array $post The values to add to $_POST
211
     * @param array $post The values to add to $_POST
211
     * @param array $params The params to pass to is_manual_grade_in_range
212
     * @param array $range The params to pass to is_manual_grade_in_range
212
     * @param bool $expected
213
     * @param bool $expected
213
     */
214
     */
214
    public function test_is_manual_grade_in_range(array $post, array $params, bool $expected): void {
215
    public function test_is_manual_grade_in_range(array $post, array $range, bool $expected): void {
215
        $_POST[] = $post;
216
        $_POST[] = $post;
216
        $this->assertEquals($expected, question_engine::is_manual_grade_in_range(...$params));
217
        $this->assertEquals($expected, question_engine::is_manual_grade_in_range(...$range));
217
    }
218
    }
Línea 218... Línea 219...
218
 
219
 
219
    /**
220
    /**
220
     * Data provider for is_manual_grade_in_range tests.
221
     * Data provider for is_manual_grade_in_range tests.
221
     *
222
     *
222
     * @return array
223
     * @return array
223
     */
224
     */
224
    public function is_manual_grade_in_range_provider(): array {
225
    public static function is_manual_grade_in_range_provider(): array {
225
        return [
226
        return [
226
            'In range' => [
227
            'In range' => [
227
                'post' => [
228
                'post' => [
228
                    'q1:2_-mark' => 0.5,
229
                    'q1:2_-mark' => 0.5,
Línea 306... Línea 307...
306
    /**
307
    /**
307
     * Data provider for test_render_question_number.
308
     * Data provider for test_render_question_number.
308
     *
309
     *
309
     * @return array
310
     * @return array
310
     */
311
     */
311
    public function render_question_number_provider(): array {
312
    public static function render_question_number_provider(): array {
312
        return [
313
        return [
313
            'Test with number is i character' => [
314
            'Test with number is i character' => [
314
                'i',
315
                'i',
315
                '<h3 class="no">Information</h3>',
316
                '<h3 class="no">Information</h3>',
316
            ],
317
            ],