Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 42... Línea 42...
42
    use \quiz_question_helper_test_trait;
42
    use \quiz_question_helper_test_trait;
Línea 43... Línea 43...
43
 
43
 
44
    /**
44
    /**
45
     * Create a quiz with questions and walk through a quiz attempt.
45
     * Create a quiz with questions and walk through a quiz attempt.
46
     */
46
     */
47
    public function test_quiz_attempt_walkthrough() {
47
    public function test_quiz_attempt_walkthrough(): void {
Línea 48... Línea 48...
48
        global $SITE;
48
        global $SITE;
Línea 49... Línea 49...
49
 
49
 
Línea 233... Línea 233...
233
        $quizobj->get_grade_calculator()->recompute_quiz_sumgrades();
233
        $quizobj->get_grade_calculator()->recompute_quiz_sumgrades();
Línea 234... Línea 234...
234
 
234
 
235
        return $quiz;
235
        return $quiz;
Línea 236... Línea 236...
236
    }
236
    }
Línea 237... Línea 237...
237
 
237
 
Línea 238... Línea 238...
238
    public function test_quiz_attempt_walkthrough_submit_time_recorded_correctly_when_overdue() {
238
    public function test_quiz_attempt_walkthrough_submit_time_recorded_correctly_when_overdue(): void {
239
 
239
 
Línea 277... Línea 277...
277
        $this->assertEquals($user->id, $attemptobj->get_userid());
277
        $this->assertEquals($user->id, $attemptobj->get_userid());
278
        $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
278
        $this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
279
        $this->assertEquals(0, $attemptobj->get_number_of_unanswered_questions());
279
        $this->assertEquals(0, $attemptobj->get_number_of_unanswered_questions());
280
    }
280
    }
Línea 281... Línea 281...
281
 
281
 
282
    public function test_quiz_attempt_walkthrough_close_time_extended_at_last_minute() {
282
    public function test_quiz_attempt_walkthrough_close_time_extended_at_last_minute(): void {
Línea 283... Línea 283...
283
        global $DB;
283
        global $DB;
284
 
284
 
Línea 316... Línea 316...
316
    }
316
    }
Línea 317... Línea 317...
317
 
317
 
318
    /**
318
    /**
319
     * Create a quiz with a random as well as other questions and walk through quiz attempts.
319
     * Create a quiz with a random as well as other questions and walk through quiz attempts.
320
     */
320
     */
321
    public function test_quiz_with_random_question_attempt_walkthrough() {
321
    public function test_quiz_with_random_question_attempt_walkthrough(): void {
Línea 322... Línea 322...
322
        global $SITE;
322
        global $SITE;
323
 
323
 
Línea 433... Línea 433...
433
    /**
433
    /**
434
     * Create a quiz with a single question with variants and walk through quiz attempts.
434
     * Create a quiz with a single question with variants and walk through quiz attempts.
435
     *
435
     *
436
     * @dataProvider get_correct_response_for_variants
436
     * @dataProvider get_correct_response_for_variants
437
     */
437
     */
438
    public function test_quiz_with_question_with_variants_attempt_walkthrough($variantno, $correctresponse, $done = false) {
438
    public function test_quiz_with_question_with_variants_attempt_walkthrough($variantno, $correctresponse, $done = false): void {
439
        global $SITE;
439
        global $SITE;
Línea 440... Línea 440...
440
 
440
 
Línea 441... Línea 441...
441
        $this->resetAfterTest($done);
441
        $this->resetAfterTest($done);
Línea 513... Línea 513...
513
        $gradebookitem = array_shift($gradebookgrades->items);
513
        $gradebookitem = array_shift($gradebookgrades->items);
514
        $gradebookgrade = array_shift($gradebookitem->grades);
514
        $gradebookgrade = array_shift($gradebookitem->grades);
515
        $this->assertEquals(100, $gradebookgrade->grade);
515
        $this->assertEquals(100, $gradebookgrade->grade);
516
    }
516
    }
Línea 517... Línea 517...
517
 
517
 
518
    public function test_quiz_attempt_walkthrough_abandoned_attempt_reopened_with_timelimit_override() {
518
    public function test_quiz_attempt_walkthrough_abandoned_attempt_reopened_with_timelimit_override(): void {
Línea 519... Línea 519...
519
        global $DB;
519
        global $DB;
520
 
520
 
Línea 573... Línea 573...
573
        $this->assertEquals($attemptobj->get_context(), $reopenedevent->get_context());
573
        $this->assertEquals($attemptobj->get_context(), $reopenedevent->get_context());
574
        $this->assertEquals(new moodle_url('/mod/quiz/review.php', ['attempt' => $attemptobj->get_attemptid()]),
574
        $this->assertEquals(new moodle_url('/mod/quiz/review.php', ['attempt' => $attemptobj->get_attemptid()]),
575
                $reopenedevent->get_url());
575
                $reopenedevent->get_url());
576
    }
576
    }
Línea 577... Línea 577...
577
 
577
 
578
    public function test_quiz_attempt_walkthrough_abandoned_attempt_reopened_after_close_time() {
578
    public function test_quiz_attempt_walkthrough_abandoned_attempt_reopened_after_close_time(): void {
579
        $quiz = $this->create_quiz_with_one_question('autoabandon');
579
        $quiz = $this->create_quiz_with_one_question('autoabandon');
Línea 580... Línea 580...
580
        $originaltimeclose = $quiz->timeclose;
580
        $originaltimeclose = $quiz->timeclose;
581
 
581