Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 52... Línea 52...
52
    /**
52
    /**
53
     * Check support
53
     * Check support
54
     *
54
     *
55
     * @covers ::bigbluebuttonbn_supports
55
     * @covers ::bigbluebuttonbn_supports
56
     */
56
     */
57
    public function test_bigbluebuttonbn_supports() {
57
    public function test_bigbluebuttonbn_supports(): void {
58
        $this->resetAfterTest();
58
        $this->resetAfterTest();
59
        $this->assertTrue(bigbluebuttonbn_supports(FEATURE_IDNUMBER));
59
        $this->assertTrue(bigbluebuttonbn_supports(FEATURE_IDNUMBER));
60
        $this->assertTrue(bigbluebuttonbn_supports(FEATURE_MOD_INTRO));
60
        $this->assertTrue(bigbluebuttonbn_supports(FEATURE_MOD_INTRO));
61
        $this->assertFalse(bigbluebuttonbn_supports(FEATURE_GRADE_HAS_GRADE));
61
        $this->assertFalse(bigbluebuttonbn_supports(FEATURE_GRADE_HAS_GRADE));
62
    }
62
    }
Línea 64... Línea 64...
64
    /**
64
    /**
65
     * Check add instance
65
     * Check add instance
66
     *
66
     *
67
     * @covers ::bigbluebuttonbn_add_instance
67
     * @covers ::bigbluebuttonbn_add_instance
68
     */
68
     */
69
    public function test_bigbluebuttonbn_add_instance() {
69
    public function test_bigbluebuttonbn_add_instance(): void {
70
        $this->resetAfterTest();
70
        $this->resetAfterTest();
71
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
71
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
72
        $bbformdata = $this->get_form_data_from_instance($bbactivity);
72
        $bbformdata = $this->get_form_data_from_instance($bbactivity);
73
        $id = bigbluebuttonbn_add_instance($bbformdata);
73
        $id = bigbluebuttonbn_add_instance($bbformdata);
74
        $this->assertNotNull($id);
74
        $this->assertNotNull($id);
Línea 77... Línea 77...
77
    /**
77
    /**
78
     * Check update instance
78
     * Check update instance
79
     *
79
     *
80
     * @covers ::bigbluebuttonbn_update_instance
80
     * @covers ::bigbluebuttonbn_update_instance
81
     */
81
     */
82
    public function test_bigbluebuttonbn_update_instance() {
82
    public function test_bigbluebuttonbn_update_instance(): void {
83
        $this->resetAfterTest();
83
        $this->resetAfterTest();
84
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
84
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
85
        $bbformdata = $this->get_form_data_from_instance($bbactivity);
85
        $bbformdata = $this->get_form_data_from_instance($bbactivity);
86
        $result = bigbluebuttonbn_update_instance($bbformdata);
86
        $result = bigbluebuttonbn_update_instance($bbformdata);
87
        $this->assertTrue($result);
87
        $this->assertTrue($result);
Línea 90... Línea 90...
90
    /**
90
    /**
91
     * Check delete instance
91
     * Check delete instance
92
     *
92
     *
93
     * @covers ::bigbluebuttonbn_delete_instance
93
     * @covers ::bigbluebuttonbn_delete_instance
94
     */
94
     */
95
    public function test_bigbluebuttonbn_delete_instance() {
95
    public function test_bigbluebuttonbn_delete_instance(): void {
96
        $this->resetAfterTest();
96
        $this->resetAfterTest();
97
        $this->initialise_mock_server();
97
        $this->initialise_mock_server();
98
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
98
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
99
        $result = bigbluebuttonbn_delete_instance($bbactivity->id);
99
        $result = bigbluebuttonbn_delete_instance($bbactivity->id);
100
        $this->assertTrue($result);
100
        $this->assertTrue($result);
Línea 103... Línea 103...
103
    /**
103
    /**
104
     * Check delete instance
104
     * Check delete instance
105
     *
105
     *
106
     * @covers ::bigbluebuttonbn_delete_instance
106
     * @covers ::bigbluebuttonbn_delete_instance
107
     */
107
     */
108
    public function test_bigbluebuttonbn_delete_instance_with_running_meeting() {
108
    public function test_bigbluebuttonbn_delete_instance_with_running_meeting(): void {
109
        $this->resetAfterTest();
109
        $this->resetAfterTest();
110
        $this->initialise_mock_server();
110
        $this->initialise_mock_server();
111
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
111
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
112
        $bbbgenerator = $this->getDataGenerator()->get_plugin_generator('mod_bigbluebuttonbn');
112
        $bbbgenerator = $this->getDataGenerator()->get_plugin_generator('mod_bigbluebuttonbn');
113
        $instance = instance::get_from_instanceid($bbactivity->id);
113
        $instance = instance::get_from_instanceid($bbactivity->id);
Línea 128... Línea 128...
128
    /**
128
    /**
129
     * Check delete instance
129
     * Check delete instance
130
     *
130
     *
131
     * @covers ::bigbluebuttonbn_delete_instance
131
     * @covers ::bigbluebuttonbn_delete_instance
132
     */
132
     */
133
    public function test_bigbluebuttonbn_delete_instance_with_running_group_meetings() {
133
    public function test_bigbluebuttonbn_delete_instance_with_running_group_meetings(): void {
134
        $this->resetAfterTest();
134
        $this->resetAfterTest();
135
        $this->initialise_mock_server();
135
        $this->initialise_mock_server();
136
        $datagenerator = $this->getDataGenerator();
136
        $datagenerator = $this->getDataGenerator();
137
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
137
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
138
        $course = $this->get_course();
138
        $course = $this->get_course();
Línea 176... Línea 176...
176
    /**
176
    /**
177
     * Check user outline page
177
     * Check user outline page
178
     *
178
     *
179
     * @covers ::bigbluebuttonbn_user_outline
179
     * @covers ::bigbluebuttonbn_user_outline
180
     */
180
     */
181
    public function test_bigbluebuttonbn_user_outline() {
181
    public function test_bigbluebuttonbn_user_outline(): void {
182
        $this->resetAfterTest();
182
        $this->resetAfterTest();
Línea 183... Línea 183...
183
 
183
 
184
        $generator = $this->getDataGenerator();
184
        $generator = $this->getDataGenerator();
185
        $user = $generator->create_user();
185
        $user = $generator->create_user();
Línea 198... Línea 198...
198
    /**
198
    /**
199
     * Check user completion
199
     * Check user completion
200
     *
200
     *
201
     * @covers ::bigbluebuttonbn_user_complete
201
     * @covers ::bigbluebuttonbn_user_complete
202
     */
202
     */
203
    public function test_bigbluebuttonbn_user_complete() {
203
    public function test_bigbluebuttonbn_user_complete(): void {
204
        $this->initialise_mock_server();
204
        $this->initialise_mock_server();
205
        $this->resetAfterTest();
205
        $this->resetAfterTest();
Línea 206... Línea 206...
206
 
206
 
207
        $generator = $this->getDataGenerator();
207
        $generator = $this->getDataGenerator();
Línea 222... Línea 222...
222
    /**
222
    /**
223
     * Check get recent activity
223
     * Check get recent activity
224
     *
224
     *
225
     * @covers ::bigbluebuttonbn_get_recent_mod_activity
225
     * @covers ::bigbluebuttonbn_get_recent_mod_activity
226
     */
226
     */
227
    public function test_bigbluebuttonbn_get_recent_mod_activity() {
227
    public function test_bigbluebuttonbn_get_recent_mod_activity(): void {
228
        $this->initialise_mock_server();
228
        $this->initialise_mock_server();
229
        $this->resetAfterTest();
229
        $this->resetAfterTest();
Línea 230... Línea 230...
230
 
230
 
231
        $generator = $this->getDataGenerator();
231
        $generator = $this->getDataGenerator();
Línea 325... Línea 325...
325
    /**
325
    /**
326
     * Check user recent activity
326
     * Check user recent activity
327
     *
327
     *
328
     * @covers ::bigbluebuttonbn_print_recent_mod_activity
328
     * @covers ::bigbluebuttonbn_print_recent_mod_activity
329
     */
329
     */
330
    public function test_bigbluebuttonbn_print_recent_mod_activity() {
330
    public function test_bigbluebuttonbn_print_recent_mod_activity(): void {
331
        $this->initialise_mock_server();
331
        $this->initialise_mock_server();
332
        $this->resetAfterTest();
332
        $this->resetAfterTest();
Línea 333... Línea 333...
333
 
333
 
334
        $generator = $this->getDataGenerator();
334
        $generator = $this->getDataGenerator();
Línea 354... Línea 354...
354
    /**
354
    /**
355
     * Check recent activity for the course
355
     * Check recent activity for the course
356
     *
356
     *
357
     * @covers ::bigbluebuttonbn_print_recent_activity
357
     * @covers ::bigbluebuttonbn_print_recent_activity
358
     */
358
     */
359
    public function test_bigbluebuttonbn_print_recent_activity() {
359
    public function test_bigbluebuttonbn_print_recent_activity(): void {
360
        global $CFG;
360
        global $CFG;
361
        $this->initialise_mock_server();
361
        $this->initialise_mock_server();
362
        $this->resetAfterTest();
362
        $this->resetAfterTest();
Línea 363... Línea 363...
363
 
363
 
Línea 403... Línea 403...
403
    /**
403
    /**
404
     * Check extra capabilities return value
404
     * Check extra capabilities return value
405
     *
405
     *
406
     * @covers ::bigbluebuttonbn_get_extra_capabilities
406
     * @covers ::bigbluebuttonbn_get_extra_capabilities
407
     */
407
     */
408
    public function test_bigbluebuttonbn_get_extra_capabilities() {
408
    public function test_bigbluebuttonbn_get_extra_capabilities(): void {
409
        $this->resetAfterTest();
409
        $this->resetAfterTest();
410
        $this->assertEquals(['moodle/site:accessallgroups'], bigbluebuttonbn_get_extra_capabilities());
410
        $this->assertEquals(['moodle/site:accessallgroups'], bigbluebuttonbn_get_extra_capabilities());
411
    }
411
    }
Línea 412... Línea 412...
412
 
412
 
413
    /**
413
    /**
414
     * Check form definition
414
     * Check form definition
415
     *
415
     *
416
     * @covers ::bigbluebuttonbn_reset_course_form_definition
416
     * @covers ::bigbluebuttonbn_reset_course_form_definition
417
     */
417
     */
418
    public function test_bigbluebuttonbn_reset_course_form_definition() {
418
    public function test_bigbluebuttonbn_reset_course_form_definition(): void {
419
        global $CFG, $PAGE;
419
        global $CFG, $PAGE;
Línea 420... Línea 420...
420
        $this->initialise_mock_server();
420
        $this->initialise_mock_server();
421
 
421
 
Línea 442... Línea 442...
442
    /**
442
    /**
443
     * Check defaults for form
443
     * Check defaults for form
444
     *
444
     *
445
     * @covers ::bigbluebuttonbn_reset_course_form_defaults
445
     * @covers ::bigbluebuttonbn_reset_course_form_defaults
446
     */
446
     */
447
    public function test_bigbluebuttonbn_reset_course_form_defaults() {
447
    public function test_bigbluebuttonbn_reset_course_form_defaults(): void {
448
        global $CFG;
448
        global $CFG;
449
        $this->resetAfterTest();
449
        $this->resetAfterTest();
450
        $results = bigbluebuttonbn_reset_course_form_defaults($this->get_course());
450
        $results = bigbluebuttonbn_reset_course_form_defaults($this->get_course());
451
        $this->assertEquals([
451
        $this->assertEquals([
452
            'reset_bigbluebuttonbn_events' => 0,
452
            'reset_bigbluebuttonbn_events' => 0,
Línea 459... Línea 459...
459
    /**
459
    /**
460
     * Reset user data
460
     * Reset user data
461
     *
461
     *
462
     * @covers ::bigbluebuttonbn_reset_userdata
462
     * @covers ::bigbluebuttonbn_reset_userdata
463
     */
463
     */
464
    public function test_bigbluebuttonbn_reset_userdata() {
464
    public function test_bigbluebuttonbn_reset_userdata(): void {
465
        global $DB;
465
        global $DB;
466
        $this->resetAfterTest();
466
        $this->resetAfterTest();
467
        $data = new stdClass();
467
        $data = new stdClass();
468
        $user = $this->getDataGenerator()->create_user();
468
        $user = $this->getDataGenerator()->create_user();
Línea 492... Línea 492...
492
    /**
492
    /**
493
     * Reset user data in a course and checks it does not delete logs elsewhere
493
     * Reset user data in a course and checks it does not delete logs elsewhere
494
     *
494
     *
495
     * @covers ::bigbluebuttonbn_reset_userdata
495
     * @covers ::bigbluebuttonbn_reset_userdata
496
     */
496
     */
497
    public function test_bigbluebuttonbn_reset_userdata_in_a_course() {
497
    public function test_bigbluebuttonbn_reset_userdata_in_a_course(): void {
498
        global $DB;
498
        global $DB;
499
        $this->resetAfterTest();
499
        $this->resetAfterTest();
500
        $data = new stdClass();
500
        $data = new stdClass();
501
        $user = $this->getDataGenerator()->create_user();
501
        $user = $this->getDataGenerator()->create_user();
Línea 525... Línea 525...
525
    /**
525
    /**
526
     * Reset user data in a course but do not delete logs
526
     * Reset user data in a course but do not delete logs
527
     *
527
     *
528
     * @covers ::bigbluebuttonbn_reset_userdata
528
     * @covers ::bigbluebuttonbn_reset_userdata
529
     */
529
     */
530
    public function test_bigbluebuttonbn_reset_userdata_logs_not_deleted() {
530
    public function test_bigbluebuttonbn_reset_userdata_logs_not_deleted(): void {
531
        global $DB;
531
        global $DB;
532
        $this->resetAfterTest();
532
        $this->resetAfterTest();
533
        $data = new stdClass();
533
        $data = new stdClass();
534
        $user = $this->getDataGenerator()->create_user();
534
        $user = $this->getDataGenerator()->create_user();
Línea 550... Línea 550...
550
    /**
550
    /**
551
     * Check course module
551
     * Check course module
552
     *
552
     *
553
     * @covers ::bigbluebuttonbn_get_coursemodule_info
553
     * @covers ::bigbluebuttonbn_get_coursemodule_info
554
     */
554
     */
555
    public function test_bigbluebuttonbn_get_coursemodule_info() {
555
    public function test_bigbluebuttonbn_get_coursemodule_info(): void {
556
        $this->resetAfterTest();
556
        $this->resetAfterTest();
557
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
557
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
558
        $info = bigbluebuttonbn_get_coursemodule_info($bbactivitycm);
558
        $info = bigbluebuttonbn_get_coursemodule_info($bbactivitycm);
559
        $this->assertEquals($info->name, $bbactivity->name);
559
        $this->assertEquals($info->name, $bbactivity->name);
560
    }
560
    }
Línea 562... Línea 562...
562
    /**
562
    /**
563
     * Check update since
563
     * Check update since
564
     *
564
     *
565
     * @covers ::bigbluebuttonbn_check_updates_since
565
     * @covers ::bigbluebuttonbn_check_updates_since
566
     */
566
     */
567
    public function test_bigbluebuttonbn_check_updates_since() {
567
    public function test_bigbluebuttonbn_check_updates_since(): void {
568
        $this->resetAfterTest();
568
        $this->resetAfterTest();
569
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
569
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
570
        $result = bigbluebuttonbn_check_updates_since($bbactivitycm, 0);
570
        $result = bigbluebuttonbn_check_updates_since($bbactivitycm, 0);
571
        $this->assertEquals(
571
        $this->assertEquals(
572
            '{"configuration":{"updated":false},"contentfiles":{"updated":false},"introfiles":' .
572
            '{"configuration":{"updated":false},"contentfiles":{"updated":false},"introfiles":' .
Línea 578... Línea 578...
578
    /**
578
    /**
579
     * Check event action (calendar)
579
     * Check event action (calendar)
580
     *
580
     *
581
     * @covers ::mod_bigbluebuttonbn_core_calendar_provide_event_action
581
     * @covers ::mod_bigbluebuttonbn_core_calendar_provide_event_action
582
     */
582
     */
583
    public function test_mod_bigbluebuttonbn_core_calendar_provide_event_action() {
583
    public function test_mod_bigbluebuttonbn_core_calendar_provide_event_action(): void {
584
        global $DB;
584
        global $DB;
585
        $this->initialise_mock_server();
585
        $this->initialise_mock_server();
586
        $this->resetAfterTest();
586
        $this->resetAfterTest();
587
        $this->setAdminUser();
587
        $this->setAdminUser();
588
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
588
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
Línea 630... Línea 630...
630
    /**
630
    /**
631
     * Test setting navigation admin menu
631
     * Test setting navigation admin menu
632
     *
632
     *
633
     * @covers ::bigbluebuttonbn_extend_settings_navigation
633
     * @covers ::bigbluebuttonbn_extend_settings_navigation
634
     */
634
     */
635
    public function test_bigbluebuttonbn_extend_settings_navigation_admin() {
635
    public function test_bigbluebuttonbn_extend_settings_navigation_admin(): void {
636
        global $PAGE, $CFG;
636
        global $PAGE, $CFG;
637
        $this->resetAfterTest();
637
        $this->resetAfterTest();
638
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
638
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
639
        $CFG->bigbluebuttonbn_meetingevents_enabled = true;
639
        $CFG->bigbluebuttonbn_meetingevents_enabled = true;
Línea 652... Línea 652...
652
    /**
652
    /**
653
     * Check additional setting menu
653
     * Check additional setting menu
654
     *
654
     *
655
     * @covers ::bigbluebuttonbn_extend_settings_navigation
655
     * @covers ::bigbluebuttonbn_extend_settings_navigation
656
     */
656
     */
657
    public function test_bigbluebuttonbn_extend_settings_navigation_user() {
657
    public function test_bigbluebuttonbn_extend_settings_navigation_user(): void {
658
        global $PAGE, $CFG;
658
        global $PAGE, $CFG;
659
        $this->resetAfterTest();
659
        $this->resetAfterTest();
Línea 660... Línea 660...
660
 
660
 
661
        $generator = $this->getDataGenerator();
661
        $generator = $this->getDataGenerator();
Línea 678... Línea 678...
678
 
678
 
679
    /**
679
    /**
680
     * Check the visibility on calendar
680
     * Check the visibility on calendar
681
     * @covers ::mod_bigbluebuttonbn_core_calendar_is_event_visible
681
     * @covers ::mod_bigbluebuttonbn_core_calendar_is_event_visible
682
     */
682
     */
683
    public function test_mod_bigbluebuttonbn_core_calendar_is_event_visible() {
683
    public function test_mod_bigbluebuttonbn_core_calendar_is_event_visible(): void {
684
        global $DB;
684
        global $DB;
685
        $this->resetAfterTest();
685
        $this->resetAfterTest();
686
        $this->setAdminUser();
686
        $this->setAdminUser();
687
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();
687
        list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance();