Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 45... Línea 45...
45
    }
45
    }
Línea 46... Línea 46...
46
 
46
 
47
    /*
47
    /*
48
     * The chat's event should not be shown to a user when the user cannot view the chat at all.
48
     * The chat's event should not be shown to a user when the user cannot view the chat at all.
49
     */
49
     */
50
    public function test_chat_core_calendar_provide_event_action_in_hidden_section() {
50
    public function test_chat_core_calendar_provide_event_action_in_hidden_section(): void {
Línea 51... Línea 51...
51
        global $CFG;
51
        global $CFG;
Línea 52... Línea 52...
52
 
52
 
Línea 83... Línea 83...
83
    }
83
    }
Línea 84... Línea 84...
84
 
84
 
85
    /*
85
    /*
86
     * The chat's event should not be shown to a user who does not have permission to view the chat at all.
86
     * The chat's event should not be shown to a user who does not have permission to view the chat at all.
87
     */
87
     */
88
    public function test_chat_core_calendar_provide_event_action_for_non_user() {
88
    public function test_chat_core_calendar_provide_event_action_for_non_user(): void {
Línea 89... Línea 89...
89
        global $CFG;
89
        global $CFG;
Línea 90... Línea 90...
90
 
90
 
Línea 112... Línea 112...
112
 
112
 
113
        // Confirm the event is not shown at all.
113
        // Confirm the event is not shown at all.
114
        $this->assertNull($actionevent);
114
        $this->assertNull($actionevent);
Línea 115... Línea 115...
115
    }
115
    }
116
 
116
 
Línea 117... Línea 117...
117
    public function test_chat_core_calendar_provide_event_action_chattime_event_yesterday() {
117
    public function test_chat_core_calendar_provide_event_action_chattime_event_yesterday(): void {
118
        $this->setAdminUser();
118
        $this->setAdminUser();
Línea 135... Línea 135...
135
 
135
 
136
        // Confirm the event is not shown at all.
136
        // Confirm the event is not shown at all.
137
        $this->assertNull($actionevent);
137
        $this->assertNull($actionevent);
Línea 138... Línea 138...
138
    }
138
    }
139
 
139
 
Línea 140... Línea 140...
140
    public function test_chat_core_calendar_provide_event_action_chattime_event_yesterday_for_user() {
140
    public function test_chat_core_calendar_provide_event_action_chattime_event_yesterday_for_user(): void {
Línea 141... Línea 141...
141
        global $CFG;
141
        global $CFG;
Línea 167... Línea 167...
167
 
167
 
168
        // Confirm the event is not shown at all.
168
        // Confirm the event is not shown at all.
169
        $this->assertNull($actionevent);
169
        $this->assertNull($actionevent);
Línea 170... Línea 170...
170
    }
170
    }
171
 
171
 
Línea 172... Línea 172...
172
    public function test_chat_core_calendar_provide_event_action_chattime_event_today() {
172
    public function test_chat_core_calendar_provide_event_action_chattime_event_today(): void {
173
        $this->setAdminUser();
173
        $this->setAdminUser();
Línea 194... Línea 194...
194
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
194
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
195
        $this->assertEquals(1, $actionevent->get_item_count());
195
        $this->assertEquals(1, $actionevent->get_item_count());
196
        $this->assertTrue($actionevent->is_actionable());
196
        $this->assertTrue($actionevent->is_actionable());
197
    }
197
    }
Línea 198... Línea 198...
198
 
198
 
199
    public function test_chat_core_calendar_provide_event_action_chattime_event_today_for_user() {
199
    public function test_chat_core_calendar_provide_event_action_chattime_event_today_for_user(): void {
Línea 200... Línea 200...
200
        global $CFG;
200
        global $CFG;
Línea 201... Línea 201...
201
 
201
 
Línea 230... Línea 230...
230
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
230
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
231
        $this->assertEquals(1, $actionevent->get_item_count());
231
        $this->assertEquals(1, $actionevent->get_item_count());
232
        $this->assertTrue($actionevent->is_actionable());
232
        $this->assertTrue($actionevent->is_actionable());
233
    }
233
    }
Línea 234... Línea 234...
234
 
234
 
235
    public function test_chat_core_calendar_provide_event_action_chattime_event_tonight() {
235
    public function test_chat_core_calendar_provide_event_action_chattime_event_tonight(): void {
Línea 236... Línea 236...
236
        $this->setAdminUser();
236
        $this->setAdminUser();
237
 
237
 
Línea 257... Línea 257...
257
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
257
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
258
        $this->assertEquals(1, $actionevent->get_item_count());
258
        $this->assertEquals(1, $actionevent->get_item_count());
259
        $this->assertTrue($actionevent->is_actionable());
259
        $this->assertTrue($actionevent->is_actionable());
260
    }
260
    }
Línea 261... Línea 261...
261
 
261
 
262
    public function test_chat_core_calendar_provide_event_action_chattime_event_tonight_for_user() {
262
    public function test_chat_core_calendar_provide_event_action_chattime_event_tonight_for_user(): void {
Línea 263... Línea 263...
263
        global $CFG;
263
        global $CFG;
Línea 264... Línea 264...
264
 
264
 
Línea 293... Línea 293...
293
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
293
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
294
        $this->assertEquals(1, $actionevent->get_item_count());
294
        $this->assertEquals(1, $actionevent->get_item_count());
295
        $this->assertTrue($actionevent->is_actionable());
295
        $this->assertTrue($actionevent->is_actionable());
296
    }
296
    }
Línea 297... Línea 297...
297
 
297
 
298
    public function test_chat_core_calendar_provide_event_action_chattime_event_tomorrow() {
298
    public function test_chat_core_calendar_provide_event_action_chattime_event_tomorrow(): void {
Línea 299... Línea 299...
299
        $this->setAdminUser();
299
        $this->setAdminUser();
300
 
300
 
Línea 320... Línea 320...
320
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
320
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
321
        $this->assertEquals(1, $actionevent->get_item_count());
321
        $this->assertEquals(1, $actionevent->get_item_count());
322
        $this->assertFalse($actionevent->is_actionable());
322
        $this->assertFalse($actionevent->is_actionable());
323
    }
323
    }
Línea 324... Línea 324...
324
 
324
 
325
    public function test_chat_core_calendar_provide_event_action_chattime_event_tomorrow_for_user() {
325
    public function test_chat_core_calendar_provide_event_action_chattime_event_tomorrow_for_user(): void {
Línea 326... Línea 326...
326
        global $CFG;
326
        global $CFG;
Línea 327... Línea 327...
327
 
327
 
Línea 356... Línea 356...
356
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
356
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
357
        $this->assertEquals(1, $actionevent->get_item_count());
357
        $this->assertEquals(1, $actionevent->get_item_count());
358
        $this->assertFalse($actionevent->is_actionable());
358
        $this->assertFalse($actionevent->is_actionable());
359
    }
359
    }
Línea 360... Línea 360...
360
 
360
 
361
    public function test_chat_core_calendar_provide_event_action_chattime_event_different_timezones() {
361
    public function test_chat_core_calendar_provide_event_action_chattime_event_different_timezones(): void {
Línea 362... Línea 362...
362
        global $CFG;
362
        global $CFG;
Línea 363... Línea 363...
363
 
363
 
Línea 441... Línea 441...
441
    }
441
    }
Línea 442... Línea 442...
442
 
442
 
443
    /**
443
    /**
444
     * Test for chat_get_sessions().
444
     * Test for chat_get_sessions().
445
     */
445
     */
446
    public function test_chat_get_sessions() {
446
    public function test_chat_get_sessions(): void {
Línea 447... Línea 447...
447
        global $DB;
447
        global $DB;
Línea 448... Línea 448...
448
 
448
 
Línea 513... Línea 513...
513
    }
513
    }
Línea 514... Línea 514...
514
 
514
 
515
    /**
515
    /**
516
     * Test for chat_get_sessions with messages belonging to multiple sessions.
516
     * Test for chat_get_sessions with messages belonging to multiple sessions.
517
     */
517
     */
518
    public function test_chat_get_sessions_multiple() {
518
    public function test_chat_get_sessions_multiple(): void {
519
        $messages = [];
519
        $messages = [];
Línea 520... Línea 520...
520
        $gap = 5; // 5 secs.
520
        $gap = 5; // 5 secs.
521
 
521
 
Línea 638... Línea 638...
638
            $this->assertEquals($sessionstart, $session->sessionstart);
638
            $this->assertEquals($sessionstart, $session->sessionstart);
639
            $this->assertEquals($sessionend, $session->sessionend);
639
            $this->assertEquals($sessionend, $session->sessionend);
640
        }
640
        }
641
    }
641
    }
Línea 642... Línea 642...
642
 
642
 
643
    public function test_chat_core_calendar_provide_event_action_already_completed() {
643
    public function test_chat_core_calendar_provide_event_action_already_completed(): void {
644
        set_config('enablecompletion', 1);
644
        set_config('enablecompletion', 1);
Línea 645... Línea 645...
645
        $this->setAdminUser();
645
        $this->setAdminUser();
646
 
646
 
Línea 668... Línea 668...
668
 
668
 
669
        // Ensure result was null.
669
        // Ensure result was null.
670
        $this->assertNull($actionevent);
670
        $this->assertNull($actionevent);
Línea 671... Línea 671...
671
    }
671
    }
672
 
672
 
673
    public function test_chat_core_calendar_provide_event_action_already_completed_for_user() {
673
    public function test_chat_core_calendar_provide_event_action_already_completed_for_user(): void {
Línea 674... Línea 674...
674
        set_config('enablecompletion', 1);
674
        set_config('enablecompletion', 1);
675
        $this->setAdminUser();
675
        $this->setAdminUser();
Línea 725... Línea 725...
725
    }
725
    }
Línea 726... Línea 726...
726
 
726
 
727
    /**
727
    /**
728
     * A user who does not have capabilities to add events to the calendar should be able to create an chat.
728
     * A user who does not have capabilities to add events to the calendar should be able to create an chat.
729
     */
729
     */
730
    public function test_creation_with_no_calendar_capabilities() {
730
    public function test_creation_with_no_calendar_capabilities(): void {
731
        $this->resetAfterTest();
731
        $this->resetAfterTest();
732
        $course = self::getDataGenerator()->create_course();
732
        $course = self::getDataGenerator()->create_course();
733
        $context = \context_course::instance($course->id);
733
        $context = \context_course::instance($course->id);
734
        $user = self::getDataGenerator()->create_and_enrol($course, 'editingteacher');
734
        $user = self::getDataGenerator()->create_and_enrol($course, 'editingteacher');