Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 36... Línea 36...
36
 
36
 
37
    /**
37
    /**
38
     * Test that get_action_events_by_timesort returns events after the
38
     * Test that get_action_events_by_timesort returns events after the
39
     * provided timesort value.
39
     * provided timesort value.
40
     */
40
     */
41
    public function test_get_action_events_by_timesort_after_time() {
41
    public function test_get_action_events_by_timesort_after_time(): void {
Línea 42... Línea 42...
42
        $this->resetAfterTest(true);
42
        $this->resetAfterTest(true);
43
 
43
 
44
        $user = $this->getDataGenerator()->create_user();
44
        $user = $this->getDataGenerator()->create_user();
Línea 77... Línea 77...
77
 
77
 
78
    /**
78
    /**
79
     * Test that get_action_events_by_timesort returns events before the
79
     * Test that get_action_events_by_timesort returns events before the
80
     * provided timesort value.
80
     * provided timesort value.
81
     */
81
     */
82
    public function test_get_action_events_by_timesort_before_time() {
82
    public function test_get_action_events_by_timesort_before_time(): void {
83
        $this->resetAfterTest(true);
83
        $this->resetAfterTest(true);
Línea 84... Línea 84...
84
        $this->setAdminuser();
84
        $this->setAdminuser();
85
 
85
 
Línea 118... Línea 118...
118
 
118
 
119
    /**
119
    /**
120
     * Test that get_action_events_by_timesort returns events between the
120
     * Test that get_action_events_by_timesort returns events between the
121
     * provided timesort values.
121
     * provided timesort values.
122
     */
122
     */
123
    public function test_get_action_events_by_timesort_between_time() {
123
    public function test_get_action_events_by_timesort_between_time(): void {
124
        $this->resetAfterTest(true);
124
        $this->resetAfterTest(true);
Línea 125... Línea 125...
125
        $this->setAdminuser();
125
        $this->setAdminuser();
126
 
126
 
Línea 156... Línea 156...
156
    /**
156
    /**
157
     * Test that get_action_events_by_timesort returns events between the
157
     * Test that get_action_events_by_timesort returns events between the
158
     * provided timesort values and after the last seen event when one is
158
     * provided timesort values and after the last seen event when one is
159
     * provided.
159
     * provided.
160
     */
160
     */
161
    public function test_get_action_events_by_timesort_between_time_after_event() {
161
    public function test_get_action_events_by_timesort_between_time_after_event(): void {
162
        $this->resetAfterTest(true);
162
        $this->resetAfterTest(true);
163
        $this->setAdminuser();
163
        $this->setAdminuser();
Línea 164... Línea 164...
164
 
164
 
165
        $user = $this->getDataGenerator()->create_user();
165
        $user = $this->getDataGenerator()->create_user();
Línea 194... Línea 194...
194
    /**
194
    /**
195
     * Test that get_action_events_by_timesort returns events between the
195
     * Test that get_action_events_by_timesort returns events between the
196
     * provided timesort values and the last seen event can be provided to
196
     * provided timesort values and the last seen event can be provided to
197
     * get paginated results.
197
     * get paginated results.
198
     */
198
     */
199
    public function test_get_action_events_by_timesort_between_time_skip_even_records() {
199
    public function test_get_action_events_by_timesort_between_time_skip_even_records(): void {
200
        $this->resetAfterTest(true);
200
        $this->resetAfterTest(true);
201
        $this->setAdminuser();
201
        $this->setAdminuser();
Línea 202... Línea 202...
202
 
202
 
203
        $user = $this->getDataGenerator()->create_user();
203
        $user = $this->getDataGenerator()->create_user();
Línea 245... Línea 245...
245
     * Test that get_action_events_by_timesort returns events between the
245
     * Test that get_action_events_by_timesort returns events between the
246
     * provided timesort values. The database will continue to be read until the
246
     * provided timesort values. The database will continue to be read until the
247
     * number of events requested has been satisfied. In this case the first
247
     * number of events requested has been satisfied. In this case the first
248
     * five events are rejected so it should require two database requests.
248
     * five events are rejected so it should require two database requests.
249
     */
249
     */
250
    public function test_get_action_events_by_timesort_between_time_skip_first_records() {
250
    public function test_get_action_events_by_timesort_between_time_skip_first_records(): void {
251
        $this->resetAfterTest(true);
251
        $this->resetAfterTest(true);
252
        $this->setAdminuser();
252
        $this->setAdminuser();
Línea 253... Línea 253...
253
 
253
 
254
        $user = $this->getDataGenerator()->create_user();
254
        $user = $this->getDataGenerator()->create_user();
Línea 291... Línea 291...
291
     * Test that get_action_events_by_timesort returns events between the
291
     * Test that get_action_events_by_timesort returns events between the
292
     * provided timesort values and after the last seen event when one is
292
     * provided timesort values and after the last seen event when one is
293
     * provided. This should work even when the event ids aren't ordered the
293
     * provided. This should work even when the event ids aren't ordered the
294
     * same as the timesort order.
294
     * same as the timesort order.
295
     */
295
     */
296
    public function test_get_action_events_by_timesort_non_consecutive_ids() {
296
    public function test_get_action_events_by_timesort_non_consecutive_ids(): void {
297
        $this->resetAfterTest(true);
297
        $this->resetAfterTest(true);
298
        $this->setAdminuser();
298
        $this->setAdminuser();
Línea 299... Línea 299...
299
 
299
 
300
        $user = $this->getDataGenerator()->create_user();
300
        $user = $this->getDataGenerator()->create_user();
Línea 421... Línea 421...
421
     * In this situation:
421
     * In this situation:
422
     * - A user in group A should see only the A override
422
     * - A user in group A should see only the A override
423
     * - A user in group B should see only the B override
423
     * - A user in group B should see only the B override
424
     * - A user in both A and B should see both
424
     * - A user in both A and B should see both
425
     */
425
     */
426
    public function test_get_action_events_by_timesort_with_identical_group_override_priorities() {
426
    public function test_get_action_events_by_timesort_with_identical_group_override_priorities(): void {
427
        $this->resetAfterTest();
427
        $this->resetAfterTest();
428
        $this->setAdminuser();
428
        $this->setAdminuser();
Línea 429... Línea 429...
429
 
429
 
Línea 554... Línea 554...
554
 
554
 
555
    /**
555
    /**
556
     * Test that if a user is suspended that events related to that course are not shown.
556
     * Test that if a user is suspended that events related to that course are not shown.
557
     * User 1 is suspended. User 2 is active.
557
     * User 1 is suspended. User 2 is active.
558
     */
558
     */
559
    public function test_get_action_events_by_timesort_with_suspended_user() {
559
    public function test_get_action_events_by_timesort_with_suspended_user(): void {
560
        $this->resetAfterTest();
560
        $this->resetAfterTest();
561
        $user1 = $this->getDataGenerator()->create_user();
561
        $user1 = $this->getDataGenerator()->create_user();
562
        $user2 = $this->getDataGenerator()->create_user();
562
        $user2 = $this->getDataGenerator()->create_user();
563
        $course = $this->getDataGenerator()->create_course();
563
        $course = $this->getDataGenerator()->create_course();
Línea 585... Línea 585...
585
 
585
 
586
    /**
586
    /**
587
     * Test that get_action_events_by_course returns events after the
587
     * Test that get_action_events_by_course returns events after the
588
     * provided timesort value.
588
     * provided timesort value.
589
     */
589
     */
590
    public function test_get_action_events_by_course_after_time() {
590
    public function test_get_action_events_by_course_after_time(): void {
591
        $user = $this->getDataGenerator()->create_user();
591
        $user = $this->getDataGenerator()->create_user();
592
        $course1 = $this->getDataGenerator()->create_course();
592
        $course1 = $this->getDataGenerator()->create_course();
593
        $course2 = $this->getDataGenerator()->create_course();
593
        $course2 = $this->getDataGenerator()->create_course();
594
        $factory = new action_event_test_factory();
594
        $factory = new action_event_test_factory();
Línea 640... Línea 640...
640
 
640
 
641
    /**
641
    /**
642
     * Test that get_action_events_by_course returns events before the
642
     * Test that get_action_events_by_course returns events before the
643
     * provided timesort value.
643
     * provided timesort value.
644
     */
644
     */
645
    public function test_get_action_events_by_course_before_time() {
645
    public function test_get_action_events_by_course_before_time(): void {
646
        $user = $this->getDataGenerator()->create_user();
646
        $user = $this->getDataGenerator()->create_user();
647
        $course1 = $this->getDataGenerator()->create_course();
647
        $course1 = $this->getDataGenerator()->create_course();
648
        $course2 = $this->getDataGenerator()->create_course();
648
        $course2 = $this->getDataGenerator()->create_course();
649
        $factory = new action_event_test_factory();
649
        $factory = new action_event_test_factory();
Línea 696... Línea 696...
696
 
696
 
697
    /**
697
    /**
698
     * Test that get_action_events_by_course returns events between the
698
     * Test that get_action_events_by_course returns events between the
699
     * provided timesort values.
699
     * provided timesort values.
700
     */
700
     */
701
    public function test_get_action_events_by_course_between_time() {
701
    public function test_get_action_events_by_course_between_time(): void {
702
        $user = $this->getDataGenerator()->create_user();
702
        $user = $this->getDataGenerator()->create_user();
703
        $course1 = $this->getDataGenerator()->create_course();
703
        $course1 = $this->getDataGenerator()->create_course();
704
        $course2 = $this->getDataGenerator()->create_course();
704
        $course2 = $this->getDataGenerator()->create_course();
705
        $factory = new action_event_test_factory();
705
        $factory = new action_event_test_factory();
Línea 749... Línea 749...
749
    /**
749
    /**
750
     * Test that get_action_events_by_course returns events between the
750
     * Test that get_action_events_by_course returns events between the
751
     * provided timesort values and after the last seen event when one is
751
     * provided timesort values and after the last seen event when one is
752
     * provided.
752
     * provided.
753
     */
753
     */
754
    public function test_get_action_events_by_course_between_time_after_event() {
754
    public function test_get_action_events_by_course_between_time_after_event(): void {
755
        $user = $this->getDataGenerator()->create_user();
755
        $user = $this->getDataGenerator()->create_user();
756
        $course1 = $this->getDataGenerator()->create_course();
756
        $course1 = $this->getDataGenerator()->create_course();
757
        $course2 = $this->getDataGenerator()->create_course();
757
        $course2 = $this->getDataGenerator()->create_course();
758
        $factory = new action_event_test_factory();
758
        $factory = new action_event_test_factory();
759
        $strategy = new raw_event_retrieval_strategy();
759
        $strategy = new raw_event_retrieval_strategy();
Línea 802... Línea 802...
802
    /**
802
    /**
803
     * Test that get_action_events_by_course returns events between the
803
     * Test that get_action_events_by_course returns events between the
804
     * provided timesort values and the last seen event can be provided to
804
     * provided timesort values and the last seen event can be provided to
805
     * get paginated results.
805
     * get paginated results.
806
     */
806
     */
807
    public function test_get_action_events_by_course_between_time_skip_even_records() {
807
    public function test_get_action_events_by_course_between_time_skip_even_records(): void {
808
        $user = $this->getDataGenerator()->create_user();
808
        $user = $this->getDataGenerator()->create_user();
809
        $course1 = $this->getDataGenerator()->create_course();
809
        $course1 = $this->getDataGenerator()->create_course();
810
        $course2 = $this->getDataGenerator()->create_course();
810
        $course2 = $this->getDataGenerator()->create_course();
811
        // The factory will return every event that is divisible by 2.
811
        // The factory will return every event that is divisible by 2.
812
        $factory = new action_event_test_factory(function($actionevent) {
812
        $factory = new action_event_test_factory(function($actionevent) {
Línea 868... Línea 868...
868
     * Test that get_action_events_by_course returns events between the
868
     * Test that get_action_events_by_course returns events between the
869
     * provided timesort values. The database will continue to be read until the
869
     * provided timesort values. The database will continue to be read until the
870
     * number of events requested has been satisfied. In this case the first
870
     * number of events requested has been satisfied. In this case the first
871
     * five events are rejected so it should require two database requests.
871
     * five events are rejected so it should require two database requests.
872
     */
872
     */
873
    public function test_get_action_events_by_course_between_time_skip_first_records() {
873
    public function test_get_action_events_by_course_between_time_skip_first_records(): void {
874
        $user = $this->getDataGenerator()->create_user();
874
        $user = $this->getDataGenerator()->create_user();
875
        $course1 = $this->getDataGenerator()->create_course();
875
        $course1 = $this->getDataGenerator()->create_course();
876
        $course2 = $this->getDataGenerator()->create_course();
876
        $course2 = $this->getDataGenerator()->create_course();
877
        $limit = 5;
877
        $limit = 5;
878
        $seen = 0;
878
        $seen = 0;
Línea 929... Línea 929...
929
     * Test that get_action_events_by_course returns events between the
929
     * Test that get_action_events_by_course returns events between the
930
     * provided timesort values and after the last seen event when one is
930
     * provided timesort values and after the last seen event when one is
931
     * provided. This should work even when the event ids aren't ordered the
931
     * provided. This should work even when the event ids aren't ordered the
932
     * same as the timesort order.
932
     * same as the timesort order.
933
     */
933
     */
934
    public function test_get_action_events_by_course_non_consecutive_ids() {
934
    public function test_get_action_events_by_course_non_consecutive_ids(): void {
935
        $this->resetAfterTest(true);
935
        $this->resetAfterTest(true);
936
        $this->setAdminuser();
936
        $this->setAdminuser();
Línea 937... Línea 937...
937
 
937
 
938
        $user = $this->getDataGenerator()->create_user();
938
        $user = $this->getDataGenerator()->create_user();
Línea 1078... Línea 1078...
1078
     * In this situation:
1078
     * In this situation:
1079
     * - A user in group A should see only the A override
1079
     * - A user in group A should see only the A override
1080
     * - A user in group B should see only the B override
1080
     * - A user in group B should see only the B override
1081
     * - A user in both A and B should see both
1081
     * - A user in both A and B should see both
1082
     */
1082
     */
1083
    public function test_get_action_events_by_course_with_identical_group_override_priorities() {
1083
    public function test_get_action_events_by_course_with_identical_group_override_priorities(): void {
1084
        $this->resetAfterTest();
1084
        $this->resetAfterTest();
1085
        $this->setAdminuser();
1085
        $this->setAdminuser();
Línea 1086... Línea 1086...
1086
 
1086