Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 96... Línea 96...
96
 
96
 
97
    /** Test scorm_check_mode
97
    /** Test scorm_check_mode
98
     *
98
     *
99
     * @return void
99
     * @return void
100
     */
100
     */
101
    public function test_scorm_check_mode() {
101
    public function test_scorm_check_mode(): void {
Línea 102... Línea 102...
102
        global $CFG;
102
        global $CFG;
103
 
103
 
104
        $newattempt = 'on';
104
        $newattempt = 'on';
Línea 138... Línea 138...
138
 
138
 
139
    /**
139
    /**
140
     * Test scorm_view
140
     * Test scorm_view
141
     * @return void
141
     * @return void
142
     */
142
     */
143
    public function test_scorm_view() {
143
    public function test_scorm_view(): void {
Línea 144... Línea 144...
144
        global $CFG;
144
        global $CFG;
145
 
145
 
Línea 163... Línea 163...
163
 
163
 
164
    /**
164
    /**
165
     * Test scorm_get_availability_status and scorm_require_available
165
     * Test scorm_get_availability_status and scorm_require_available
166
     * @return void
166
     * @return void
167
     */
167
     */
168
    public function test_scorm_check_and_require_available() {
168
    public function test_scorm_check_and_require_available(): void {
Línea 169... Línea 169...
169
        global $DB;
169
        global $DB;
Línea 170... Línea 170...
170
 
170
 
Línea 276... Línea 276...
276
    /**
276
    /**
277
     * Test scorm_get_last_completed_attempt
277
     * Test scorm_get_last_completed_attempt
278
     *
278
     *
279
     * @return void
279
     * @return void
280
     */
280
     */
281
    public function test_scorm_get_last_completed_attempt() {
281
    public function test_scorm_get_last_completed_attempt(): void {
282
        $this->assertEquals(1, scorm_get_last_completed_attempt($this->scorm->id, $this->student->id));
282
        $this->assertEquals(1, scorm_get_last_completed_attempt($this->scorm->id, $this->student->id));
283
    }
283
    }
Línea 284... Línea 284...
284
 
284
 
285
    public function test_scorm_core_calendar_provide_event_action_open() {
285
    public function test_scorm_core_calendar_provide_event_action_open(): void {
Línea 286... Línea 286...
286
        $this->resetAfterTest();
286
        $this->resetAfterTest();
Línea 287... Línea 287...
287
 
287
 
Línea 312... Línea 312...
312
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
312
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
313
        $this->assertEquals(1, $actionevent->get_item_count());
313
        $this->assertEquals(1, $actionevent->get_item_count());
314
        $this->assertTrue($actionevent->is_actionable());
314
        $this->assertTrue($actionevent->is_actionable());
315
    }
315
    }
Línea 316... Línea 316...
316
 
316
 
317
    public function test_scorm_core_calendar_provide_event_action_closed() {
317
    public function test_scorm_core_calendar_provide_event_action_closed(): void {
Línea 318... Línea 318...
318
        $this->resetAfterTest();
318
        $this->resetAfterTest();
Línea 319... Línea 319...
319
 
319
 
Línea 337... Línea 337...
337
 
337
 
338
        // No event on the dashboard if module is closed.
338
        // No event on the dashboard if module is closed.
339
        $this->assertNull($actionevent);
339
        $this->assertNull($actionevent);
Línea 340... Línea 340...
340
    }
340
    }
341
 
341
 
Línea 342... Línea 342...
342
    public function test_scorm_core_calendar_provide_event_action_open_in_future() {
342
    public function test_scorm_core_calendar_provide_event_action_open_in_future(): void {
Línea 343... Línea 343...
343
        $this->resetAfterTest();
343
        $this->resetAfterTest();
Línea 369... Línea 369...
369
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
369
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
370
        $this->assertEquals(1, $actionevent->get_item_count());
370
        $this->assertEquals(1, $actionevent->get_item_count());
371
        $this->assertFalse($actionevent->is_actionable());
371
        $this->assertFalse($actionevent->is_actionable());
372
    }
372
    }
Línea 373... Línea 373...
373
 
373
 
374
    public function test_scorm_core_calendar_provide_event_action_with_different_user_as_admin() {
374
    public function test_scorm_core_calendar_provide_event_action_with_different_user_as_admin(): void {
Línea 375... Línea 375...
375
        $this->resetAfterTest();
375
        $this->resetAfterTest();
Línea 376... Línea 376...
376
 
376
 
Línea 402... Línea 402...
402
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
402
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
403
        $this->assertEquals(1, $actionevent->get_item_count());
403
        $this->assertEquals(1, $actionevent->get_item_count());
404
        $this->assertFalse($actionevent->is_actionable());
404
        $this->assertFalse($actionevent->is_actionable());
405
    }
405
    }
Línea 406... Línea 406...
406
 
406
 
407
    public function test_scorm_core_calendar_provide_event_action_no_time_specified() {
407
    public function test_scorm_core_calendar_provide_event_action_no_time_specified(): void {
Línea 408... Línea 408...
408
        $this->resetAfterTest();
408
        $this->resetAfterTest();
Línea 409... Línea 409...
409
 
409
 
Línea 433... Línea 433...
433
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
433
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
434
        $this->assertEquals(1, $actionevent->get_item_count());
434
        $this->assertEquals(1, $actionevent->get_item_count());
435
        $this->assertTrue($actionevent->is_actionable());
435
        $this->assertTrue($actionevent->is_actionable());
436
    }
436
    }
Línea 437... Línea 437...
437
 
437
 
438
    public function test_scorm_core_calendar_provide_event_action_already_completed() {
438
    public function test_scorm_core_calendar_provide_event_action_already_completed(): void {
439
        $this->resetAfterTest();
439
        $this->resetAfterTest();
440
        set_config('enablecompletion', 1);
440
        set_config('enablecompletion', 1);
Línea 441... Línea 441...
441
        $this->setAdminUser();
441
        $this->setAdminUser();
Línea 464... Línea 464...
464
 
464
 
465
        // Ensure result was null.
465
        // Ensure result was null.
466
        $this->assertNull($actionevent);
466
        $this->assertNull($actionevent);
Línea 467... Línea 467...
467
    }
467
    }
468
 
468
 
469
    public function test_scorm_core_calendar_provide_event_action_already_completed_for_user() {
469
    public function test_scorm_core_calendar_provide_event_action_already_completed_for_user(): void {
470
        $this->resetAfterTest();
470
        $this->resetAfterTest();
Línea 471... Línea 471...
471
        set_config('enablecompletion', 1);
471
        set_config('enablecompletion', 1);
Línea 531... Línea 531...
531
    /**
531
    /**
532
     * Test the callback responsible for returning the completion rule descriptions.
532
     * Test the callback responsible for returning the completion rule descriptions.
533
     * This function should work given either an instance of the module (cm_info), such as when checking the active rules,
533
     * This function should work given either an instance of the module (cm_info), such as when checking the active rules,
534
     * or if passed a stdClass of similar structure, such as when checking the the default completion settings for a mod type.
534
     * or if passed a stdClass of similar structure, such as when checking the the default completion settings for a mod type.
535
     */
535
     */
536
    public function test_mod_scorm_completion_get_active_rule_descriptions() {
536
    public function test_mod_scorm_completion_get_active_rule_descriptions(): void {
537
        $this->resetAfterTest();
537
        $this->resetAfterTest();
538
        $this->setAdminUser();
538
        $this->setAdminUser();
Línea 539... Línea 539...
539
 
539
 
540
        // Two activities, both with automatic completion. One has the 'completionsubmit' rule, one doesn't.
540
        // Two activities, both with automatic completion. One has the 'completionsubmit' rule, one doesn't.
Línea 588... Línea 588...
588
    }
588
    }
Línea 589... Línea 589...
589
 
589
 
590
    /**
590
    /**
591
     * An unkown event type should not change the scorm instance.
591
     * An unkown event type should not change the scorm instance.
592
     */
592
     */
593
    public function test_mod_scorm_core_calendar_event_timestart_updated_unknown_event() {
593
    public function test_mod_scorm_core_calendar_event_timestart_updated_unknown_event(): void {
594
        global $CFG, $DB;
594
        global $CFG, $DB;
Línea 595... Línea 595...
595
        require_once($CFG->dirroot . "/calendar/lib.php");
595
        require_once($CFG->dirroot . "/calendar/lib.php");
596
 
596
 
Línea 631... Línea 631...
631
 
631
 
632
    /**
632
    /**
633
     * A SCORM_EVENT_TYPE_OPEN event should update the timeopen property of
633
     * A SCORM_EVENT_TYPE_OPEN event should update the timeopen property of
634
     * the scorm activity.
634
     * the scorm activity.
635
     */
635
     */
636
    public function test_mod_scorm_core_calendar_event_timestart_updated_open_event() {
636
    public function test_mod_scorm_core_calendar_event_timestart_updated_open_event(): void {
637
        global $CFG, $DB;
637
        global $CFG, $DB;
Línea 638... Línea 638...
638
        require_once($CFG->dirroot . "/calendar/lib.php");
638
        require_once($CFG->dirroot . "/calendar/lib.php");
639
 
639
 
Línea 692... Línea 692...
692
 
692
 
693
    /**
693
    /**
694
     * A SCORM_EVENT_TYPE_CLOSE event should update the timeclose property of
694
     * A SCORM_EVENT_TYPE_CLOSE event should update the timeclose property of
695
     * the scorm activity.
695
     * the scorm activity.
696
     */
696
     */
697
    public function test_mod_scorm_core_calendar_event_timestart_updated_close_event() {
697
    public function test_mod_scorm_core_calendar_event_timestart_updated_close_event(): void {
698
        global $CFG, $DB;
698
        global $CFG, $DB;
Línea 699... Línea 699...
699
        require_once($CFG->dirroot . "/calendar/lib.php");
699
        require_once($CFG->dirroot . "/calendar/lib.php");
700
 
700
 
Línea 752... Línea 752...
752
    }
752
    }
Línea 753... Línea 753...
753
 
753
 
754
    /**
754
    /**
755
     * An unkown event type should not have any limits
755
     * An unkown event type should not have any limits
756
     */
756
     */
757
    public function test_mod_scorm_core_calendar_get_valid_event_timestart_range_unknown_event() {
757
    public function test_mod_scorm_core_calendar_get_valid_event_timestart_range_unknown_event(): void {
758
        global $CFG, $DB;
758
        global $CFG, $DB;
Línea 759... Línea 759...
759
        require_once($CFG->dirroot . "/calendar/lib.php");
759
        require_once($CFG->dirroot . "/calendar/lib.php");
760
 
760
 
Línea 790... Línea 790...
790
    }
790
    }
Línea 791... Línea 791...
791
 
791
 
792
    /**
792
    /**
793
     * The open event should be limited by the scorm's timeclose property, if it's set.
793
     * The open event should be limited by the scorm's timeclose property, if it's set.
794
     */
794
     */
795
    public function test_mod_scorm_core_calendar_get_valid_event_timestart_range_open_event() {
795
    public function test_mod_scorm_core_calendar_get_valid_event_timestart_range_open_event(): void {
796
        global $CFG, $DB;
796
        global $CFG, $DB;
Línea 797... Línea 797...
797
        require_once($CFG->dirroot . "/calendar/lib.php");
797
        require_once($CFG->dirroot . "/calendar/lib.php");
798
 
798
 
Línea 837... Línea 837...
837
    }
837
    }
Línea 838... Línea 838...
838
 
838
 
839
    /**
839
    /**
840
     * The close event should be limited by the scorm's timeopen property, if it's set.
840
     * The close event should be limited by the scorm's timeopen property, if it's set.
841
     */
841
     */
842
    public function test_mod_scorm_core_calendar_get_valid_event_timestart_range_close_event() {
842
    public function test_mod_scorm_core_calendar_get_valid_event_timestart_range_close_event(): void {
843
        global $CFG, $DB;
843
        global $CFG, $DB;
Línea 844... Línea 844...
844
        require_once($CFG->dirroot . "/calendar/lib.php");
844
        require_once($CFG->dirroot . "/calendar/lib.php");
845
 
845
 
Línea 884... Línea 884...
884
    }
884
    }
Línea 885... Línea 885...
885
 
885
 
886
    /**
886
    /**
887
     * A user who does not have capabilities to add events to the calendar should be able to create a SCORM.
887
     * A user who does not have capabilities to add events to the calendar should be able to create a SCORM.
888
     */
888
     */
889
    public function test_creation_with_no_calendar_capabilities() {
889
    public function test_creation_with_no_calendar_capabilities(): void {
890
        $this->resetAfterTest();
890
        $this->resetAfterTest();
891
        $course = self::getDataGenerator()->create_course();
891
        $course = self::getDataGenerator()->create_course();
892
        $context = \context_course::instance($course->id);
892
        $context = \context_course::instance($course->id);
893
        $user = self::getDataGenerator()->create_and_enrol($course, 'editingteacher');
893
        $user = self::getDataGenerator()->create_and_enrol($course, 'editingteacher');