Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 215... Línea 215...
215
    }
215
    }
Línea 216... Línea 216...
216
 
216
 
217
    /*
217
    /*
218
     * Test get quizzes by courses
218
     * Test get quizzes by courses
219
     */
219
     */
220
    public function test_mod_quiz_get_quizzes_by_courses() {
220
    public function test_mod_quiz_get_quizzes_by_courses(): void {
Línea 221... Línea 221...
221
        global $DB;
221
        global $DB;
222
 
222
 
Línea 363... Línea 363...
363
    }
363
    }
Línea 364... Línea 364...
364
 
364
 
365
    /**
365
    /**
366
     * Test test_view_quiz
366
     * Test test_view_quiz
367
     */
367
     */
368
    public function test_view_quiz() {
368
    public function test_view_quiz(): void {
Línea 369... Línea 369...
369
        global $DB;
369
        global $DB;
370
 
370
 
371
        // Test invalid instance id.
371
        // Test invalid instance id.
Línea 541... Línea 541...
541
    }
541
    }
Línea 542... Línea 542...
542
 
542
 
543
    /**
543
    /**
544
     * Test get_user_attempts with marks hidden
544
     * Test get_user_attempts with marks hidden
545
     */
545
     */
546
    public function test_get_user_attempts_with_marks_hidden() {
546
    public function test_get_user_attempts_with_marks_hidden(): void {
547
        // Create quiz with one attempt finished and hide the mark.
547
        // Create quiz with one attempt finished and hide the mark.
548
        list($quiz, $context, $quizobj, $attempt, $attemptobj) = $this->create_quiz_with_questions(
548
        list($quiz, $context, $quizobj, $attempt, $attemptobj) = $this->create_quiz_with_questions(
549
                true, true, 'deferredfeedback', false,
549
                true, true, 'deferredfeedback', false,
Línea 577... Línea 577...
577
    }
577
    }
Línea 578... Línea 578...
578
 
578
 
579
    /**
579
    /**
580
     * Test get_user_best_grade
580
     * Test get_user_best_grade
581
     */
581
     */
582
    public function test_get_user_best_grade() {
582
    public function test_get_user_best_grade(): void {
583
        $quizgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quiz');
583
        $quizgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quiz');
584
        $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
584
        $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
Línea 585... Línea 585...
585
        $questioncat = $questiongenerator->create_question_category();
585
        $questioncat = $questiongenerator->create_question_category();
Línea 745... Línea 745...
745
    }
745
    }
746
    /**
746
    /**
747
     * Test get_combined_review_options.
747
     * Test get_combined_review_options.
748
     * This is a basic test, this is already tested in display_options_testcase.
748
     * This is a basic test, this is already tested in display_options_testcase.
749
     */
749
     */
750
    public function test_get_combined_review_options() {
750
    public function test_get_combined_review_options(): void {
751
        global $DB;
751
        global $DB;
Línea 752... Línea 752...
752
 
752
 
753
        // Create a new quiz with attempts.
753
        // Create a new quiz with attempts.
754
        $quizgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quiz');
754
        $quizgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quiz');
Línea 962... Línea 962...
962
    }
962
    }
Línea 963... Línea 963...
963
 
963
 
964
    /**
964
    /**
965
     * Test start_attempt
965
     * Test start_attempt
966
     */
966
     */
967
    public function test_start_attempt() {
967
    public function test_start_attempt(): void {
Línea 968... Línea 968...
968
        global $DB;
968
        global $DB;
969
 
969
 
Línea 1053... Línea 1053...
1053
    }
1053
    }
Línea 1054... Línea 1054...
1054
 
1054
 
1055
    /**
1055
    /**
1056
     * Test validate_attempt
1056
     * Test validate_attempt
1057
     */
1057
     */
1058
    public function test_validate_attempt() {
1058
    public function test_validate_attempt(): void {
Línea 1059... Línea 1059...
1059
        global $DB;
1059
        global $DB;
1060
 
1060
 
Línea 1162... Línea 1162...
1162
    }
1162
    }
Línea 1163... Línea 1163...
1163
 
1163
 
1164
    /**
1164
    /**
1165
     * Test get_attempt_data
1165
     * Test get_attempt_data
1166
     */
1166
     */
1167
    public function test_get_attempt_data() {
1167
    public function test_get_attempt_data(): void {
Línea 1168... Línea 1168...
1168
        global $DB;
1168
        global $DB;
1169
 
1169
 
1170
        $timenow = time();
1170
        $timenow = time();
Línea 1276... Línea 1276...
1276
 
1276
 
1277
    /**
1277
    /**
1278
     * Test get_attempt_data with blocked questions.
1278
     * Test get_attempt_data with blocked questions.
1279
     * @since 3.2
1279
     * @since 3.2
1280
     */
1280
     */
1281
    public function test_get_attempt_data_with_blocked_questions() {
1281
    public function test_get_attempt_data_with_blocked_questions(): void {
Línea 1282... Línea 1282...
1282
        global $DB;
1282
        global $DB;
1283
 
1283
 
1284
        // Create a new quiz with one attempt started and using immediatefeedback.
1284
        // Create a new quiz with one attempt started and using immediatefeedback.
Línea 1320... Línea 1320...
1320
    }
1320
    }
Línea 1321... Línea 1321...
1321
 
1321
 
1322
    /**
1322
    /**
1323
     * Test get_attempt_summary
1323
     * Test get_attempt_summary
1324
     */
1324
     */
Línea 1325... Línea 1325...
1325
    public function test_get_attempt_summary() {
1325
    public function test_get_attempt_summary(): void {
1326
 
1326
 
1327
        $timenow = time();
1327
        $timenow = time();
Línea 1383... Línea 1383...
1383
    }
1383
    }
Línea 1384... Línea 1384...
1384
 
1384
 
1385
    /**
1385
    /**
1386
     * Test save_attempt
1386
     * Test save_attempt
1387
     */
1387
     */
Línea 1388... Línea 1388...
1388
    public function test_save_attempt() {
1388
    public function test_save_attempt(): void {
1389
 
1389
 
1390
        $timenow = time();
1390
        $timenow = time();
Línea 1456... Línea 1456...
1456
    }
1456
    }
Línea 1457... Línea 1457...
1457
 
1457
 
1458
    /**
1458
    /**
1459
     * Test process_attempt
1459
     * Test process_attempt
1460
     */
1460
     */
1461
    public function test_process_attempt() {
1461
    public function test_process_attempt(): void {
Línea 1462... Línea 1462...
1462
        global $DB;
1462
        global $DB;
1463
 
1463
 
1464
        $timenow = time();
1464
        $timenow = time();
Línea 1645... Línea 1645...
1645
    }
1645
    }
Línea 1646... Línea 1646...
1646
 
1646
 
1647
    /**
1647
    /**
1648
     * Test validate_attempt_review
1648
     * Test validate_attempt_review
1649
     */
1649
     */
1650
    public function test_validate_attempt_review() {
1650
    public function test_validate_attempt_review(): void {
Línea 1651... Línea 1651...
1651
        global $DB;
1651
        global $DB;
1652
 
1652
 
Línea 1813... Línea 1813...
1813
    }
1813
    }
Línea 1814... Línea 1814...
1814
 
1814
 
1815
    /**
1815
    /**
1816
     * Test test_view_attempt
1816
     * Test test_view_attempt
1817
     */
1817
     */
1818
    public function test_view_attempt() {
1818
    public function test_view_attempt(): void {
Línea 1819... Línea 1819...
1819
        global $DB;
1819
        global $DB;
1820
 
1820
 
Línea 1866... Línea 1866...
1866
    }
1866
    }
Línea 1867... Línea 1867...
1867
 
1867
 
1868
    /**
1868
    /**
1869
     * Test test_view_attempt_summary
1869
     * Test test_view_attempt_summary
1870
     */
1870
     */
1871
    public function test_view_attempt_summary() {
1871
    public function test_view_attempt_summary(): void {
Línea 1872... Línea 1872...
1872
        global $DB;
1872
        global $DB;
1873
 
1873
 
Línea 1907... Línea 1907...
1907
    }
1907
    }
Línea 1908... Línea 1908...
1908
 
1908
 
1909
    /**
1909
    /**
1910
     * Test test_view_attempt_summary
1910
     * Test test_view_attempt_summary
1911
     */
1911
     */
1912
    public function test_view_attempt_review() {
1912
    public function test_view_attempt_review(): void {
Línea 1913... Línea 1913...
1913
        global $DB;
1913
        global $DB;
1914
 
1914
 
Línea 1940... Línea 1940...
1940
    }
1940
    }
Línea 1941... Línea 1941...
1941
 
1941
 
1942
    /**
1942
    /**
1943
     * Test get_quiz_feedback_for_grade
1943
     * Test get_quiz_feedback_for_grade
1944
     */
1944
     */
1945
    public function test_get_quiz_feedback_for_grade() {
1945
    public function test_get_quiz_feedback_for_grade(): void {
Línea 1946... Línea 1946...
1946
        global $DB;
1946
        global $DB;
1947
 
1947
 
1948
        // Add feedback to the quiz.
1948
        // Add feedback to the quiz.
Línea 1990... Línea 1990...
1990
    }
1990
    }
Línea 1991... Línea 1991...
1991
 
1991
 
1992
    /**
1992
    /**
1993
     * Test get_quiz_access_information
1993
     * Test get_quiz_access_information
1994
     */
1994
     */
1995
    public function test_get_quiz_access_information() {
1995
    public function test_get_quiz_access_information(): void {
Línea 1996... Línea 1996...
1996
        global $DB;
1996
        global $DB;
1997
 
1997
 
1998
        // Create a new quiz.
1998
        // Create a new quiz.
Línea 2053... Línea 2053...
2053
    }
2053
    }
Línea 2054... Línea 2054...
2054
 
2054
 
2055
    /**
2055
    /**
2056
     * Test get_attempt_access_information
2056
     * Test get_attempt_access_information
2057
     */
2057
     */
2058
    public function test_get_attempt_access_information() {
2058
    public function test_get_attempt_access_information(): void {
Línea 2059... Línea 2059...
2059
        global $DB;
2059
        global $DB;
Línea 2060... Línea 2060...
2060
 
2060
 
Línea 2139... Línea 2139...
2139
    }
2139
    }
Línea 2140... Línea 2140...
2140
 
2140
 
2141
    /**
2141
    /**
2142
     * Test get_quiz_required_qtypes
2142
     * Test get_quiz_required_qtypes
2143
     */
2143
     */
2144
    public function test_get_quiz_required_qtypes() {
2144
    public function test_get_quiz_required_qtypes(): void {
Línea 2145... Línea 2145...
2145
        $this->setAdminUser();
2145
        $this->setAdminUser();
2146
 
2146
 
2147
        // Create a new quiz.
2147
        // Create a new quiz.
Línea 2184... Línea 2184...
2184
    }
2184
    }
Línea 2185... Línea 2185...
2185
 
2185
 
2186
    /**
2186
    /**
2187
     * Test get_quiz_required_qtypes for quiz with random questions
2187
     * Test get_quiz_required_qtypes for quiz with random questions
2188
     */
2188
     */
2189
    public function test_get_quiz_required_qtypes_random() {
2189
    public function test_get_quiz_required_qtypes_random(): void {
Línea 2190... Línea 2190...
2190
        $this->setAdminUser();
2190
        $this->setAdminUser();
2191
 
2191
 
2192
        // Create a new quiz.
2192
        // Create a new quiz.
Línea 2235... Línea 2235...
2235
    }
2235
    }
Línea 2236... Línea 2236...
2236
 
2236
 
2237
    /**
2237
    /**
2238
     * Test that a sequential navigation quiz is not allowing to see questions in advance except if reviewing
2238
     * Test that a sequential navigation quiz is not allowing to see questions in advance except if reviewing
2239
     */
2239
     */
2240
    public function test_sequential_navigation_view_attempt() {
2240
    public function test_sequential_navigation_view_attempt(): void {
2241
        // Test user with full capabilities.
2241
        // Test user with full capabilities.
2242
        $quiz = $this->prepare_sequential_quiz();
2242
        $quiz = $this->prepare_sequential_quiz();
2243
        $attemptobj = $this->create_quiz_attempt_object($quiz);
2243
        $attemptobj = $this->create_quiz_attempt_object($quiz);
2244
        $this->setUser($this->student);
2244
        $this->setUser($this->student);
Línea 2253... Línea 2253...
2253
    }
2253
    }
Línea 2254... Línea 2254...
2254
 
2254
 
2255
    /**
2255
    /**
2256
     * Test that a sequential navigation quiz is not allowing to see questions content in advance for a student.
2256
     * Test that a sequential navigation quiz is not allowing to see questions content in advance for a student.
2257
     */
2257
     */
2258
    public function test_sequential_navigation_attempt_summary() {
2258
    public function test_sequential_navigation_attempt_summary(): void {
2259
        // Test user with full capabilities.
2259
        // Test user with full capabilities.
2260
        $quiz = $this->prepare_sequential_quiz();
2260
        $quiz = $this->prepare_sequential_quiz();
2261
        $attemptobj = $this->create_quiz_attempt_object($quiz);
2261
        $attemptobj = $this->create_quiz_attempt_object($quiz);
2262
        $this->setUser($this->student);
2262
        $this->setUser($this->student);
Línea 2271... Línea 2271...
2271
    }
2271
    }
Línea 2272... Línea 2272...
2272
 
2272
 
2273
    /**
2273
    /**
2274
     * Test that a sequential navigation quiz is not allowing to see questions in advance for student
2274
     * Test that a sequential navigation quiz is not allowing to see questions in advance for student
2275
     */
2275
     */
2276
    public function test_sequential_navigation_get_attempt_data() {
2276
    public function test_sequential_navigation_get_attempt_data(): void {
2277
        // Test user with full capabilities.
2277
        // Test user with full capabilities.
2278
        $quiz = $this->prepare_sequential_quiz();
2278
        $quiz = $this->prepare_sequential_quiz();
2279
        $attemptobj = $this->create_quiz_attempt_object($quiz);
2279
        $attemptobj = $this->create_quiz_attempt_object($quiz);
2280
        $this->setUser($this->student);
2280
        $this->setUser($this->student);