Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 31... Línea 31...
31
class manager_test extends \advanced_testcase {
31
class manager_test extends \advanced_testcase {
Línea 32... Línea 32...
32
 
32
 
33
    /**
33
    /**
34
     * Test for static create methods.
34
     * Test for static create methods.
35
     */
35
     */
Línea 36... Línea 36...
36
    public function test_create() {
36
    public function test_create(): void {
37
 
37
 
Línea 38... Línea 38...
38
        $this->resetAfterTest();
38
        $this->resetAfterTest();
Línea 136... Línea 136...
136
     * @param int $enabletracking if tracking is enabled
136
     * @param int $enabletracking if tracking is enabled
137
     * @param int $gradingmethod new grading method
137
     * @param int $gradingmethod new grading method
138
     * @param array $result1 student 1 results (scaled, timemodified, attempt number)
138
     * @param array $result1 student 1 results (scaled, timemodified, attempt number)
139
     * @param array $result2 student 2 results (scaled, timemodified, attempt number)
139
     * @param array $result2 student 2 results (scaled, timemodified, attempt number)
140
     */
140
     */
141
    public function test_get_users_scaled_score(int $enabletracking, int $gradingmethod, array $result1, array $result2) {
141
    public function test_get_users_scaled_score(int $enabletracking, int $gradingmethod, array $result1, array $result2): void {
142
        global $DB;
142
        global $DB;
Línea 143... Línea 143...
143
 
143
 
144
        $this->resetAfterTest();
144
        $this->resetAfterTest();
Línea 250... Línea 250...
250
    }
250
    }
Línea 251... Línea 251...
251
 
251
 
252
    /**
252
    /**
253
     * Test static get_grading_methods.
253
     * Test static get_grading_methods.
254
     */
254
     */
255
    public function test_get_grading_methods() {
255
    public function test_get_grading_methods(): void {
256
        $methods = manager::get_grading_methods();
256
        $methods = manager::get_grading_methods();
257
        $this->assertCount(5, $methods);
257
        $this->assertCount(5, $methods);
258
        $this->assertNotEmpty($methods[manager::GRADEHIGHESTATTEMPT]);
258
        $this->assertNotEmpty($methods[manager::GRADEHIGHESTATTEMPT]);
259
        $this->assertNotEmpty($methods[manager::GRADEAVERAGEATTEMPT]);
259
        $this->assertNotEmpty($methods[manager::GRADEAVERAGEATTEMPT]);
Línea 268... Línea 268...
268
     * @dataProvider get_selected_attempt_data
268
     * @dataProvider get_selected_attempt_data
269
     * @param int $enabletracking if tracking is enabled
269
     * @param int $enabletracking if tracking is enabled
270
     * @param int $gradingmethod new grading method
270
     * @param int $gradingmethod new grading method
271
     * @param int $result the expected result
271
     * @param int $result the expected result
272
     */
272
     */
273
    public function test_get_selected_attempt(int $enabletracking, int $gradingmethod, int $result) {
273
    public function test_get_selected_attempt(int $enabletracking, int $gradingmethod, int $result): void {
274
        $this->resetAfterTest();
274
        $this->resetAfterTest();
275
        $this->setAdminUser();
275
        $this->setAdminUser();
Línea 276... Línea 276...
276
 
276
 
277
        $course = $this->getDataGenerator()->create_course();
277
        $course = $this->getDataGenerator()->create_course();
Línea 327... Línea 327...
327
    }
327
    }
Línea 328... Línea 328...
328
 
328
 
329
    /**
329
    /**
330
     * Test static get_review_modes.
330
     * Test static get_review_modes.
331
     */
331
     */
332
    public function test_get_review_modes() {
332
    public function test_get_review_modes(): void {
333
        $methods = manager::get_review_modes();
333
        $methods = manager::get_review_modes();
334
        $this->assertCount(2, $methods);
334
        $this->assertCount(2, $methods);
335
        $this->assertNotEmpty($methods[manager::REVIEWCOMPLETION]);
335
        $this->assertNotEmpty($methods[manager::REVIEWCOMPLETION]);
336
        $this->assertNotEmpty($methods[manager::REVIEWNONE]);
336
        $this->assertNotEmpty($methods[manager::REVIEWNONE]);
Línea 337... Línea 337...
337
    }
337
    }
338
 
338
 
339
    /**
339
    /**
340
     * Test get_grader method.
340
     * Test get_grader method.
341
     */
341
     */
342
    public function test_get_grader() {
342
    public function test_get_grader(): void {
Línea 343... Línea 343...
343
        $this->resetAfterTest();
343
        $this->resetAfterTest();
344
        $this->setAdminUser();
344
        $this->setAdminUser();
Línea 362... Línea 362...
362
     * @param int $enabletracking if tracking is enabled
362
     * @param int $enabletracking if tracking is enabled
363
     * @param bool $usestudent if test must be done with a user role
363
     * @param bool $usestudent if test must be done with a user role
364
     * @param bool $useloggedin if test must be done with the loggedin user
364
     * @param bool $useloggedin if test must be done with the loggedin user
365
     * @param bool $result the expected result
365
     * @param bool $result the expected result
366
     */
366
     */
367
    public function test_can_view_all_attempts(int $enabletracking, bool $usestudent, bool $useloggedin, bool $result) {
367
    public function test_can_view_all_attempts(int $enabletracking, bool $usestudent, bool $useloggedin, bool $result): void {
368
        global $USER;
368
        global $USER;
Línea 369... Línea 369...
369
 
369
 
370
        $this->resetAfterTest();
370
        $this->resetAfterTest();
Línea 440... Línea 440...
440
     * @param bool $useloggedin if test must be done with the loggedin user
440
     * @param bool $useloggedin if test must be done with the loggedin user
441
     * @param bool $hasattempts if the student have attempts
441
     * @param bool $hasattempts if the student have attempts
442
     * @param bool $result the expected result
442
     * @param bool $result the expected result
443
     */
443
     */
444
    public function test_can_view_own_attempts(int $enabletracking, int $reviewmode,
444
    public function test_can_view_own_attempts(int $enabletracking, int $reviewmode,
445
            bool $useloggedin, bool $hasattempts, bool $result) {
445
            bool $useloggedin, bool $hasattempts, bool $result): void {
Línea 446... Línea 446...
446
 
446
 
447
        $this->resetAfterTest();
447
        $this->resetAfterTest();
Línea 448... Línea 448...
448
        $this->setAdminUser();
448
        $this->setAdminUser();
Línea 528... Línea 528...
528
    }
528
    }
Línea 529... Línea 529...
529
 
529
 
530
    /**
530
    /**
531
     * Test static count_attempts of one user.
531
     * Test static count_attempts of one user.
532
     */
532
     */
Línea 533... Línea 533...
533
    public function test_count_attempts() {
533
    public function test_count_attempts(): void {
534
 
534
 
Línea 535... Línea 535...
535
        $this->resetAfterTest();
535
        $this->resetAfterTest();
Línea 565... Línea 565...
565
     * @param bool $canview if the student role has mod_h5pactivity/view capability
565
     * @param bool $canview if the student role has mod_h5pactivity/view capability
566
     * @param bool $cansubmit if the student role has mod_h5pactivity/submit capability
566
     * @param bool $cansubmit if the student role has mod_h5pactivity/submit capability
567
     * @param bool $extrarole if an extra role without submit capability is required
567
     * @param bool $extrarole if an extra role without submit capability is required
568
     * @param int $result the expected result
568
     * @param int $result the expected result
569
     */
569
     */
570
    public function test_count_attempts_all(bool $canview, bool $cansubmit, bool $extrarole, int $result) {
570
    public function test_count_attempts_all(bool $canview, bool $cansubmit, bool $extrarole, int $result): void {
571
        global $DB;
571
        global $DB;
Línea 572... Línea 572...
572
 
572
 
573
        $this->resetAfterTest();
573
        $this->resetAfterTest();
Línea 632... Línea 632...
632
     *
632
     *
633
     * @dataProvider get_active_users_join_data
633
     * @dataProvider get_active_users_join_data
634
     * @param bool $allpotentialusers if the join should return all potential users or only the submitted ones.
634
     * @param bool $allpotentialusers if the join should return all potential users or only the submitted ones.
635
     * @param int $result the expected result
635
     * @param int $result the expected result
636
     */
636
     */
637
    public function test_get_active_users_join(bool $allpotentialusers, int $result) {
637
    public function test_get_active_users_join(bool $allpotentialusers, int $result): void {
638
        global $DB;
638
        global $DB;
Línea 639... Línea 639...
639
 
639
 
640
        $this->resetAfterTest();
640
        $this->resetAfterTest();
Línea 800... Línea 800...
800
    }
800
    }
Línea 801... Línea 801...
801
 
801
 
802
    /**
802
    /**
803
     * Test static count_attempts.
803
     * Test static count_attempts.
804
     */
804
     */
Línea 805... Línea 805...
805
    public function test_count_users_attempts() {
805
    public function test_count_users_attempts(): void {
806
 
806
 
Línea 807... Línea 807...
807
        $this->resetAfterTest();
807
        $this->resetAfterTest();
Línea 841... Línea 841...
841
     * @param bool $createattempts if the student have attempts
841
     * @param bool $createattempts if the student have attempts
842
     * @param string $role the user role (student or editingteacher)
842
     * @param string $role the user role (student or editingteacher)
843
     * @param array $results the expected classname (or null)
843
     * @param array $results the expected classname (or null)
844
     */
844
     */
845
    public function test_get_report(int $enabletracking, int $reviewmode, bool $createattempts,
845
    public function test_get_report(int $enabletracking, int $reviewmode, bool $createattempts,
846
            string $role, array $results) {
846
            string $role, array $results): void {
Línea 847... Línea 847...
847
 
847
 
848
        $this->resetAfterTest();
848
        $this->resetAfterTest();
Línea 849... Línea 849...
849
        $this->setAdminUser();
849
        $this->setAdminUser();