Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 32... Línea 32...
32
 */
32
 */
33
class raw_event_retrieval_strategy_test extends \advanced_testcase {
33
class raw_event_retrieval_strategy_test extends \advanced_testcase {
34
    /**
34
    /**
35
     * Test retrieval strategy when module is disabled.
35
     * Test retrieval strategy when module is disabled.
36
     */
36
     */
37
    public function test_get_raw_events_with_disabled_module() {
37
    public function test_get_raw_events_with_disabled_module(): void {
38
        global $DB;
38
        global $DB;
Línea 39... Línea 39...
39
 
39
 
40
        $this->resetAfterTest();
40
        $this->resetAfterTest();
41
        $retrievalstrategy = new raw_event_retrieval_strategy();
41
        $retrievalstrategy = new raw_event_retrieval_strategy();
Línea 111... Línea 111...
111
    }
111
    }
Línea 112... Línea 112...
112
 
112
 
113
    /**
113
    /**
114
     * Test retrieval strategy when there are overrides.
114
     * Test retrieval strategy when there are overrides.
115
     */
115
     */
116
    public function test_get_raw_event_strategy_with_overrides() {
116
    public function test_get_raw_event_strategy_with_overrides(): void {
Línea 117... Línea 117...
117
        $this->resetAfterTest();
117
        $this->resetAfterTest();
118
 
118
 
119
        $retrievalstrategy = new raw_event_retrieval_strategy();
119
        $retrievalstrategy = new raw_event_retrieval_strategy();
Línea 296... Línea 296...
296
    }
296
    }
Línea 297... Línea 297...
297
 
297
 
298
    /**
298
    /**
299
     * Test retrieval strategy with category specifications.
299
     * Test retrieval strategy with category specifications.
300
     */
300
     */
301
    public function test_get_raw_events_category() {
301
    public function test_get_raw_events_category(): void {
302
        $this->resetAfterTest();
302
        $this->resetAfterTest();
303
        $retrievalstrategy = new raw_event_retrieval_strategy();
303
        $retrievalstrategy = new raw_event_retrieval_strategy();
304
        $generator = $this->getDataGenerator();
304
        $generator = $this->getDataGenerator();
305
        $category1 = $generator->create_category();
305
        $category1 = $generator->create_category();
Línea 357... Línea 357...
357
        // Get events for several categories.
357
        // Get events for several categories.
358
        $events = $retrievalstrategy->get_raw_events(null, null, null, [$category1->id, $category2->id]);
358
        $events = $retrievalstrategy->get_raw_events(null, null, null, [$category1->id, $category2->id]);
359
        $this->assertCount(2, $events);
359
        $this->assertCount(2, $events);
360
    }
360
    }
Línea 361... Línea 361...
361
 
361
 
362
    public function test_get_raw_events_for_multiple_users() {
362
    public function test_get_raw_events_for_multiple_users(): void {
Línea 363... Línea 363...
363
        $this->resetAfterTest();
363
        $this->resetAfterTest();
Línea 364... Línea 364...
364
 
364
 
Línea 400... Línea 400...
400
        $this->assertEqualsCanonicalizing(
400
        $this->assertEqualsCanonicalizing(
401
                ['User1 Event', 'User2 Event'],
401
                ['User1 Event', 'User2 Event'],
402
                array_column($events, 'name'));
402
                array_column($events, 'name'));
403
    }
403
    }
Línea 404... Línea 404...
404
 
404
 
405
    public function test_get_raw_events_for_groups_with_no_members() {
405
    public function test_get_raw_events_for_groups_with_no_members(): void {
Línea 406... Línea 406...
406
        $this->resetAfterTest();
406
        $this->resetAfterTest();
Línea 407... Línea 407...
407
 
407
 
Línea 445... Línea 445...
445
     * Test retrieval strategy with empty filters.
445
     * Test retrieval strategy with empty filters.
446
     * This covers a edge case not covered elsewhere to ensure its SQL is cross
446
     * This covers a edge case not covered elsewhere to ensure its SQL is cross
447
     * db compatible. The test is ensuring we don't get a DML Exception with
447
     * db compatible. The test is ensuring we don't get a DML Exception with
448
     * the filters setup this way.
448
     * the filters setup this way.
449
     */
449
     */
450
    public function test_get_raw_events_with_empty_user_and_category_lists() {
450
    public function test_get_raw_events_with_empty_user_and_category_lists(): void {
451
        $retrievalstrategy = new raw_event_retrieval_strategy;
451
        $retrievalstrategy = new raw_event_retrieval_strategy;
452
        $retrievalstrategy->get_raw_events([], null, null, []);
452
        $retrievalstrategy->get_raw_events([], null, null, []);
453
    }
453
    }
454
}
454
}