Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 88... Línea 88...
88
    }
88
    }
Línea 89... Línea 89...
89
 
89
 
90
    /**
90
    /**
91
     * Ensure that a user with no lastaccess is not flagged for deletion.
91
     * Ensure that a user with no lastaccess is not flagged for deletion.
92
     */
92
     */
93
    public function test_flag_not_setup() {
93
    public function test_flag_not_setup(): void {
Línea 94... Línea 94...
94
        $this->resetAfterTest();
94
        $this->resetAfterTest();
Línea 95... Línea 95...
95
 
95
 
Línea 109... Línea 109...
109
    }
109
    }
Línea 110... Línea 110...
110
 
110
 
111
    /**
111
    /**
112
     * Ensure that a user with no lastaccess is not flagged for deletion.
112
     * Ensure that a user with no lastaccess is not flagged for deletion.
113
     */
113
     */
114
    public function test_flag_user_no_lastaccess() {
114
    public function test_flag_user_no_lastaccess(): void {
Línea 115... Línea 115...
115
        $this->resetAfterTest();
115
        $this->resetAfterTest();
Línea 116... Línea 116...
116
 
116
 
Línea 132... Línea 132...
132
    }
132
    }
Línea 133... Línea 133...
133
 
133
 
134
    /**
134
    /**
135
     * Ensure that a user with a recent lastaccess is not flagged for deletion.
135
     * Ensure that a user with a recent lastaccess is not flagged for deletion.
136
     */
136
     */
137
    public function test_flag_user_recent_lastaccess() {
137
    public function test_flag_user_recent_lastaccess(): void {
Línea 138... Línea 138...
138
        $this->resetAfterTest();
138
        $this->resetAfterTest();
Línea 139... Línea 139...
139
 
139
 
Línea 155... Línea 155...
155
    }
155
    }
Línea 156... Línea 156...
156
 
156
 
157
    /**
157
    /**
158
     * Ensure that a user with a lastaccess in the past is flagged for deletion.
158
     * Ensure that a user with a lastaccess in the past is flagged for deletion.
159
     */
159
     */
160
    public function test_flag_user_past_lastaccess() {
160
    public function test_flag_user_past_lastaccess(): void {
Línea 161... Línea 161...
161
        $this->resetAfterTest();
161
        $this->resetAfterTest();
Línea 162... Línea 162...
162
 
162
 
Línea 179... Línea 179...
179
    }
179
    }
Línea 180... Línea 180...
180
 
180
 
181
    /**
181
    /**
182
     * Ensure that a user with a lastaccess in the past but active enrolments is not flagged for deletion.
182
     * Ensure that a user with a lastaccess in the past but active enrolments is not flagged for deletion.
183
     */
183
     */
184
    public function test_flag_user_past_lastaccess_still_enrolled() {
184
    public function test_flag_user_past_lastaccess_still_enrolled(): void {
Línea 185... Línea 185...
185
        $this->resetAfterTest();
185
        $this->resetAfterTest();
Línea 186... Línea 186...
186
 
186
 
Línea 207... Línea 207...
207
    }
207
    }
Línea 208... Línea 208...
208
 
208
 
209
    /**
209
    /**
210
     * Ensure that a user with a lastaccess in the past and no active enrolments is flagged for deletion.
210
     * Ensure that a user with a lastaccess in the past and no active enrolments is flagged for deletion.
211
     */
211
     */
212
    public function test_flag_user_update_existing() {
212
    public function test_flag_user_update_existing(): void {
Línea 213... Línea 213...
213
        $this->resetAfterTest();
213
        $this->resetAfterTest();
Línea 214... Línea 214...
214
 
214
 
Línea 239... Línea 239...
239
    }
239
    }
Línea 240... Línea 240...
240
 
240
 
241
    /**
241
    /**
242
     * Ensure that a user with a lastaccess in the past and expired enrolments.
242
     * Ensure that a user with a lastaccess in the past and expired enrolments.
243
     */
243
     */
244
    public function test_flag_user_past_lastaccess_unexpired_past_enrolment() {
244
    public function test_flag_user_past_lastaccess_unexpired_past_enrolment(): void {
Línea 245... Línea 245...
245
        $this->resetAfterTest();
245
        $this->resetAfterTest();
Línea 246... Línea 246...
246
 
246
 
Línea 267... Línea 267...
267
    }
267
    }
Línea 268... Línea 268...
268
 
268
 
269
    /**
269
    /**
270
     * Ensure that a user with a lastaccess in the past and expired enrolments.
270
     * Ensure that a user with a lastaccess in the past and expired enrolments.
271
     */
271
     */
272
    public function test_flag_user_past_override_role() {
272
    public function test_flag_user_past_override_role(): void {
273
        global $DB;
273
        global $DB;
Línea 274... Línea 274...
274
        $this->resetAfterTest();
274
        $this->resetAfterTest();
Línea 301... Línea 301...
301
    }
301
    }
Línea 302... Línea 302...
302
 
302
 
303
    /**
303
    /**
304
     * Ensure that a user with a lastaccess in the past and expired enrolments.
304
     * Ensure that a user with a lastaccess in the past and expired enrolments.
305
     */
305
     */
306
    public function test_flag_user_past_lastaccess_expired_enrolled() {
306
    public function test_flag_user_past_lastaccess_expired_enrolled(): void {
Línea 307... Línea 307...
307
        $this->resetAfterTest();
307
        $this->resetAfterTest();
Línea 308... Línea 308...
308
 
308
 
Línea 330... Línea 330...
330
 
330
 
331
    /**
331
    /**
332
     * Ensure that a user with a lastaccess in the past and enrolments without a course end date are respected
332
     * Ensure that a user with a lastaccess in the past and enrolments without a course end date are respected
333
     * correctly.
333
     * correctly.
334
     */
334
     */
335
    public function test_flag_user_past_lastaccess_missing_enddate_required() {
335
    public function test_flag_user_past_lastaccess_missing_enddate_required(): void {
Línea 336... Línea 336...
336
        $this->resetAfterTest();
336
        $this->resetAfterTest();
Línea 337... Línea 337...
337
 
337
 
Línea 362... Línea 362...
362
 
362
 
363
    /**
363
    /**
364
     * Ensure that a user with a lastaccess in the past and enrolments without a course end date are respected
364
     * Ensure that a user with a lastaccess in the past and enrolments without a course end date are respected
365
     * correctly when the end date is not required.
365
     * correctly when the end date is not required.
366
     */
366
     */
367
    public function test_flag_user_past_lastaccess_missing_enddate_not_required() {
367
    public function test_flag_user_past_lastaccess_missing_enddate_not_required(): void {
Línea 368... Línea 368...
368
        $this->resetAfterTest();
368
        $this->resetAfterTest();
Línea 369... Línea 369...
369
 
369
 
Línea 393... Línea 393...
393
    }
393
    }
Línea 394... Línea 394...
394
 
394
 
395
    /**
395
    /**
396
     * Ensure that a user with a recent lastaccess is not flagged for deletion.
396
     * Ensure that a user with a recent lastaccess is not flagged for deletion.
397
     */
397
     */
398
    public function test_flag_user_recent_lastaccess_existing_record() {
398
    public function test_flag_user_recent_lastaccess_existing_record(): void {
Línea 399... Línea 399...
399
        $this->resetAfterTest();
399
        $this->resetAfterTest();
Línea 400... Línea 400...
400
 
400
 
Línea 427... Línea 427...
427
    }
427
    }
Línea 428... Línea 428...
428
 
428
 
429
    /**
429
    /**
430
     * Ensure that a user with a recent lastaccess is not flagged for deletion.
430
     * Ensure that a user with a recent lastaccess is not flagged for deletion.
431
     */
431
     */
432
    public function test_flag_user_retention_changed() {
432
    public function test_flag_user_retention_changed(): void {
Línea 433... Línea 433...
433
        $this->resetAfterTest();
433
        $this->resetAfterTest();
Línea 434... Línea 434...
434
 
434
 
Línea 467... Línea 467...
467
    }
467
    }
Línea 468... Línea 468...
468
 
468
 
469
    /**
469
    /**
470
     * Ensure that a user with a historically expired expired block record child is cleaned up.
470
     * Ensure that a user with a historically expired expired block record child is cleaned up.
471
     */
471
     */
472
    public function test_flag_user_historic_block_unapproved() {
472
    public function test_flag_user_historic_block_unapproved(): void {
Línea 473... Línea 473...
473
        $this->resetAfterTest();
473
        $this->resetAfterTest();
Línea 474... Línea 474...
474
 
474
 
Línea 504... Línea 504...
504
    }
504
    }
Línea 505... Línea 505...
505
 
505
 
506
    /**
506
    /**
507
     * Ensure that a user with a block which has a default retention period which has not expired, is still expired.
507
     * Ensure that a user with a block which has a default retention period which has not expired, is still expired.
508
     */
508
     */
509
    public function test_flag_user_historic_unexpired_child() {
509
    public function test_flag_user_historic_unexpired_child(): void {
Línea 510... Línea 510...
510
        $this->resetAfterTest();
510
        $this->resetAfterTest();
511
 
511
 
Línea 532... Línea 532...
532
    }
532
    }
Línea 533... Línea 533...
533
 
533
 
534
    /**
534
    /**
535
     * Ensure that a course with no end date is not flagged.
535
     * Ensure that a course with no end date is not flagged.
536
     */
536
     */
537
    public function test_flag_course_no_enddate() {
537
    public function test_flag_course_no_enddate(): void {
Línea 538... Línea 538...
538
        $this->resetAfterTest();
538
        $this->resetAfterTest();
Línea 539... Línea 539...
539
 
539
 
Línea 551... Línea 551...
551
    }
551
    }
Línea 552... Línea 552...
552
 
552
 
553
    /**
553
    /**
554
     * Ensure that a course with an end date in the distant past, but a child which is unexpired is not flagged.
554
     * Ensure that a course with an end date in the distant past, but a child which is unexpired is not flagged.
555
     */
555
     */
556
    public function test_flag_course_past_enddate_future_child() {
556
    public function test_flag_course_past_enddate_future_child(): void {
Línea 557... Línea 557...
557
        $this->resetAfterTest();
557
        $this->resetAfterTest();
Línea 558... Línea 558...
558
 
558
 
Línea 573... Línea 573...
573
    }
573
    }
Línea 574... Línea 574...
574
 
574
 
575
    /**
575
    /**
576
     * Ensure that a course with an end date in the distant past is flagged.
576
     * Ensure that a course with an end date in the distant past is flagged.
577
     */
577
     */
578
    public function test_flag_course_past_enddate() {
578
    public function test_flag_course_past_enddate(): void {
Línea 579... Línea 579...
579
        $this->resetAfterTest();
579
        $this->resetAfterTest();
Línea 580... Línea 580...
580
 
580
 
Línea 595... Línea 595...
595
    }
595
    }
Línea 596... Línea 596...
596
 
596
 
597
    /**
597
    /**
598
     * Ensure that a course with an end date in the distant past is flagged.
598
     * Ensure that a course with an end date in the distant past is flagged.
599
     */
599
     */
600
    public function test_flag_course_past_enddate_multiple() {
600
    public function test_flag_course_past_enddate_multiple(): void {
Línea 601... Línea 601...
601
        $this->resetAfterTest();
601
        $this->resetAfterTest();
Línea 602... Línea 602...
602
 
602
 
Línea 623... Línea 623...
623
    }
623
    }
Línea 624... Línea 624...
624
 
624
 
625
    /**
625
    /**
626
     * Ensure that a course with an end date in the future is not flagged.
626
     * Ensure that a course with an end date in the future is not flagged.
627
     */
627
     */
628
    public function test_flag_course_future_enddate() {
628
    public function test_flag_course_future_enddate(): void {
Línea 629... Línea 629...
629
        $this->resetAfterTest();
629
        $this->resetAfterTest();
Línea 630... Línea 630...
630
 
630
 
Línea 642... Línea 642...
642
    }
642
    }
Línea 643... Línea 643...
643
 
643
 
644
    /**
644
    /**
645
     * Ensure that a course with an end date in the future is not flagged.
645
     * Ensure that a course with an end date in the future is not flagged.
646
     */
646
     */
647
    public function test_flag_course_recent_unexpired_enddate() {
647
    public function test_flag_course_recent_unexpired_enddate(): void {
Línea 648... Línea 648...
648
        $this->resetAfterTest();
648
        $this->resetAfterTest();
Línea 649... Línea 649...
649
 
649
 
Línea 660... Línea 660...
660
    }
660
    }
Línea 661... Línea 661...
661
 
661
 
662
    /**
662
    /**
663
     * Ensure that a course with an end date in the distant past is flagged, taking into account any purpose override
663
     * Ensure that a course with an end date in the distant past is flagged, taking into account any purpose override
664
     */
664
     */
665
    public function test_flag_course_past_enddate_with_override_unexpired_role() {
665
    public function test_flag_course_past_enddate_with_override_unexpired_role(): void {
666
        global $DB;
666
        global $DB;
Línea 667... Línea 667...
667
        $this->resetAfterTest();
667
        $this->resetAfterTest();
Línea 699... Línea 699...
699
    }
699
    }
Línea 700... Línea 700...
700
 
700
 
701
    /**
701
    /**
702
     * Ensure that a course with an end date in the distant past is flagged, and any expired role is ignored.
702
     * Ensure that a course with an end date in the distant past is flagged, and any expired role is ignored.
703
     */
703
     */
704
    public function test_flag_course_past_enddate_with_override_expired_role() {
704
    public function test_flag_course_past_enddate_with_override_expired_role(): void {
705
        global $DB;
705
        global $DB;
Línea 706... Línea 706...
706
        $this->resetAfterTest();
706
        $this->resetAfterTest();
Línea 738... Línea 738...
738
 
738
 
739
    /**
739
    /**
740
     * Ensure that where a course has explicitly expired one role, but that role is explicitly not expired in a child
740
     * Ensure that where a course has explicitly expired one role, but that role is explicitly not expired in a child
741
     * context, does not have the parent context role expired.
741
     * context, does not have the parent context role expired.
742
     */
742
     */
743
    public function test_flag_course_override_expiredwith_override_unexpired_on_child() {
743
    public function test_flag_course_override_expiredwith_override_unexpired_on_child(): void {
744
        global $DB;
744
        global $DB;
Línea 745... Línea 745...
745
        $this->resetAfterTest();
745
        $this->resetAfterTest();
Línea 807... Línea 807...
807
    }
807
    }
Línea 808... Línea 808...
808
 
808
 
809
    /**
809
    /**
810
     * Ensure that a user context previously flagged as approved is not removed if the user has any unexpired roles.
810
     * Ensure that a user context previously flagged as approved is not removed if the user has any unexpired roles.
811
     */
811
     */
812
    public function test_process_user_context_with_override_unexpired_role() {
812
    public function test_process_user_context_with_override_unexpired_role(): void {
813
        global $DB;
813
        global $DB;
Línea 814... Línea 814...
814
        $this->resetAfterTest();
814
        $this->resetAfterTest();
Línea 865... Línea 865...
865
    }
865
    }
Línea 866... Línea 866...
866
 
866
 
867
    /**
867
    /**
868
     * Ensure that a module context previously flagged as approved is removed with appropriate unexpiredroles kept.
868
     * Ensure that a module context previously flagged as approved is removed with appropriate unexpiredroles kept.
869
     */
869
     */
870
    public function test_process_course_context_with_override_unexpired_role() {
870
    public function test_process_course_context_with_override_unexpired_role(): void {
871
        global $DB;
871
        global $DB;
Línea 872... Línea 872...
872
        $this->resetAfterTest();
872
        $this->resetAfterTest();
Línea 953... Línea 953...
953
    }
953
    }
Línea 954... Línea 954...
954
 
954
 
955
    /**
955
    /**
956
     * Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
956
     * Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
957
     */
957
     */
958
    public function test_process_course_context_with_override_expired_role() {
958
    public function test_process_course_context_with_override_expired_role(): void {
959
        global $DB;
959
        global $DB;
Línea 960... Línea 960...
960
        $this->resetAfterTest();
960
        $this->resetAfterTest();
Línea 1041... Línea 1041...
1041
    }
1041
    }
Línea 1042... Línea 1042...
1042
 
1042
 
1043
    /**
1043
    /**
1044
     * Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
1044
     * Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
1045
     */
1045
     */
1046
    public function test_process_course_context_with_user_in_both_lists() {
1046
    public function test_process_course_context_with_user_in_both_lists(): void {
1047
        global $DB;
1047
        global $DB;
Línea 1048... Línea 1048...
1048
        $this->resetAfterTest();
1048
        $this->resetAfterTest();
Línea 1130... Línea 1130...
1130
    }
1130
    }
Línea 1131... Línea 1131...
1131
 
1131
 
1132
    /**
1132
    /**
1133
     * Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
1133
     * Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
1134
     */
1134
     */
1135
    public function test_process_course_context_with_user_in_both_lists_expired() {
1135
    public function test_process_course_context_with_user_in_both_lists_expired(): void {
1136
        global $DB;
1136
        global $DB;
Línea 1137... Línea 1137...
1137
        $this->resetAfterTest();
1137
        $this->resetAfterTest();
Línea 1226... Línea 1226...
1226
    }
1226
    }
Línea 1227... Línea 1227...
1227
 
1227
 
1228
    /**
1228
    /**
1229
     * Ensure that a site not setup will not process anything.
1229
     * Ensure that a site not setup will not process anything.
1230
     */
1230
     */
1231
    public function test_process_not_setup() {
1231
    public function test_process_not_setup(): void {
Línea 1232... Línea 1232...
1232
        $this->resetAfterTest();
1232
        $this->resetAfterTest();
1233
 
1233
 
Línea 1263... Línea 1263...
1263
    }
1263
    }
Línea 1264... Línea 1264...
1264
 
1264
 
1265
    /**
1265
    /**
1266
     * Ensure that a user with no lastaccess is not flagged for deletion.
1266
     * Ensure that a user with no lastaccess is not flagged for deletion.
1267
     */
1267
     */
1268
    public function test_process_none_approved() {
1268
    public function test_process_none_approved(): void {
Línea 1269... Línea 1269...
1269
        $this->resetAfterTest();
1269
        $this->resetAfterTest();
Línea 1270... Línea 1270...
1270
 
1270
 
Línea 1302... Línea 1302...
1302
    }
1302
    }
Línea 1303... Línea 1303...
1303
 
1303
 
1304
    /**
1304
    /**
1305
     * Ensure that a user with no lastaccess is not flagged for deletion.
1305
     * Ensure that a user with no lastaccess is not flagged for deletion.
1306
     */
1306
     */
1307
    public function test_process_no_context() {
1307
    public function test_process_no_context(): void {
Línea 1308... Línea 1308...
1308
        $this->resetAfterTest();
1308
        $this->resetAfterTest();
Línea 1309... Línea 1309...
1309
 
1309
 
Línea 1341... Línea 1341...
1341
    }
1341
    }
Línea 1342... Línea 1342...
1342
 
1342
 
1343
    /**
1343
    /**
1344
     * Ensure that a user context previously flagged as approved is removed.
1344
     * Ensure that a user context previously flagged as approved is removed.
1345
     */
1345
     */
1346
    public function test_process_user_context() {
1346
    public function test_process_user_context(): void {
Línea 1347... Línea 1347...
1347
        $this->resetAfterTest();
1347
        $this->resetAfterTest();
Línea 1348... Línea 1348...
1348
 
1348
 
Línea 1403... Línea 1403...
1403
    }
1403
    }
Línea 1404... Línea 1404...
1404
 
1404
 
1405
    /**
1405
    /**
1406
     * Ensure that a course context previously flagged as approved is removed.
1406
     * Ensure that a course context previously flagged as approved is removed.
1407
     */
1407
     */
1408
    public function test_process_course_context() {
1408
    public function test_process_course_context(): void {
Línea 1409... Línea 1409...
1409
        $this->resetAfterTest();
1409
        $this->resetAfterTest();
Línea 1410... Línea 1410...
1410
 
1410
 
Línea 1448... Línea 1448...
1448
    }
1448
    }
Línea 1449... Línea 1449...
1449
 
1449
 
1450
    /**
1450
    /**
1451
     * Ensure that a user context previously flagged as approved is not removed if the user then logs in.
1451
     * Ensure that a user context previously flagged as approved is not removed if the user then logs in.
1452
     */
1452
     */
1453
    public function test_process_user_context_logged_in_after_approval() {
1453
    public function test_process_user_context_logged_in_after_approval(): void {
Línea 1454... Línea 1454...
1454
        $this->resetAfterTest();
1454
        $this->resetAfterTest();
Línea 1455... Línea 1455...
1455
 
1455
 
Línea 1500... Línea 1500...
1500
    }
1500
    }
Línea 1501... Línea 1501...
1501
 
1501
 
1502
    /**
1502
    /**
1503
     * Ensure that a user context previously flagged as approved is not removed if the purpose has changed.
1503
     * Ensure that a user context previously flagged as approved is not removed if the purpose has changed.
1504
     */
1504
     */
1505
    public function test_process_user_context_changed_after_approved() {
1505
    public function test_process_user_context_changed_after_approved(): void {
Línea 1506... Línea 1506...
1506
        $this->resetAfterTest();
1506
        $this->resetAfterTest();
Línea 1507... Línea 1507...
1507
 
1507
 
Línea 1552... Línea 1552...
1552
    }
1552
    }
Línea 1553... Línea 1553...
1553
 
1553
 
1554
    /**
1554
    /**
1555
     * Ensure that a user with a historically expired expired block record child is cleaned up.
1555
     * Ensure that a user with a historically expired expired block record child is cleaned up.
1556
     */
1556
     */
1557
    public function test_process_user_historic_block_unapproved() {
1557
    public function test_process_user_historic_block_unapproved(): void {
Línea 1558... Línea 1558...
1558
        $this->resetAfterTest();
1558
        $this->resetAfterTest();
Línea 1559... Línea 1559...
1559
 
1559
 
Línea 1611... Línea 1611...
1611
    }
1611
    }
Línea 1612... Línea 1612...
1612
 
1612
 
1613
    /**
1613
    /**
1614
     * Ensure that a user with a block which has a default retention period which has not expired, is still expired.
1614
     * Ensure that a user with a block which has a default retention period which has not expired, is still expired.
1615
     */
1615
     */
1616
    public function test_process_user_historic_unexpired_child() {
1616
    public function test_process_user_historic_unexpired_child(): void {
Línea 1617... Línea 1617...
1617
        $this->resetAfterTest();
1617
        $this->resetAfterTest();
1618
 
1618
 
Línea 1665... Línea 1665...
1665
 
1665
 
1666
    /**
1666
    /**
1667
     * Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
1667
     * Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
1668
     * updated.
1668
     * updated.
1669
     */
1669
     */
1670
    public function test_process_course_context_updated() {
1670
    public function test_process_course_context_updated(): void {
Línea 1671... Línea 1671...
1671
        $this->resetAfterTest();
1671
        $this->resetAfterTest();
Línea 1672... Línea 1672...
1672
 
1672
 
Línea 1716... Línea 1716...
1716
 
1716
 
1717
    /**
1717
    /**
1718
     * Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
1718
     * Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
1719
     * updated.
1719
     * updated.
1720
     */
1720
     */
1721
    public function test_process_course_context_outstanding_children() {
1721
    public function test_process_course_context_outstanding_children(): void {
Línea 1722... Línea 1722...
1722
        $this->resetAfterTest();
1722
        $this->resetAfterTest();
Línea 1723... Línea 1723...
1723
 
1723
 
Línea 1765... Línea 1765...
1765
 
1765
 
1766
    /**
1766
    /**
1767
     * Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
1767
     * Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
1768
     * updated.
1768
     * updated.
1769
     */
1769
     */
1770
    public function test_process_course_context_pending_children() {
1770
    public function test_process_course_context_pending_children(): void {
Línea 1771... Línea 1771...
1771
        $this->resetAfterTest();
1771
        $this->resetAfterTest();
Línea 1772... Línea 1772...
1772
 
1772
 
Línea 1823... Línea 1823...
1823
 
1823
 
1824
    /**
1824
    /**
1825
     * Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
1825
     * Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
1826
     * updated.
1826
     * updated.
1827
     */
1827
     */
1828
    public function test_process_course_context_approved_children() {
1828
    public function test_process_course_context_approved_children(): void {
Línea 1829... Línea 1829...
1829
        $this->resetAfterTest();
1829
        $this->resetAfterTest();
Línea 1830... Línea 1830...
1830
 
1830
 
Línea 1901... Línea 1901...
1901
     *
1901
     *
1902
     * @dataProvider    can_process_deletion_provider
1902
     * @dataProvider    can_process_deletion_provider
1903
     * @param       int     $status
1903
     * @param       int     $status
1904
     * @param       bool    $expected
1904
     * @param       bool    $expected
1905
     */
1905
     */
1906
    public function test_can_process_deletion($status, $expected) {
1906
    public function test_can_process_deletion($status, $expected): void {
1907
        $purpose = new expired_context(0, (object) [
1907
        $purpose = new expired_context(0, (object) [
1908
            'status' => $status,
1908
            'status' => $status,
Línea 1909... Línea 1909...
1909
 
1909
 
1910
            'contextid' => \context_system::instance()->id,
1910
            'contextid' => \context_system::instance()->id,
Línea 1940... Línea 1940...
1940
     *
1940
     *
1941
     * @dataProvider        is_complete_provider
1941
     * @dataProvider        is_complete_provider
1942
     * @param       int     $status
1942
     * @param       int     $status
1943
     * @param       bool    $expected
1943
     * @param       bool    $expected
1944
     */
1944
     */
1945
    public function test_is_complete($status, $expected) {
1945
    public function test_is_complete($status, $expected): void {
1946
        $purpose = new expired_context(0, (object) [
1946
        $purpose = new expired_context(0, (object) [
1947
            'status' => $status,
1947
            'status' => $status,
1948
            'contextid' => \context_system::instance()->id,
1948
            'contextid' => \context_system::instance()->id,
1949
        ]);
1949
        ]);
Línea 1978... Línea 1978...
1978
     *
1978
     *
1979
     * @dataProvider        is_fully_expired_provider
1979
     * @dataProvider        is_fully_expired_provider
1980
     * @param       array   $record
1980
     * @param       array   $record
1981
     * @param       bool    $expected
1981
     * @param       bool    $expected
1982
     */
1982
     */
1983
    public function test_is_fully_expired($record, $expected) {
1983
    public function test_is_fully_expired($record, $expected): void {
1984
        $purpose = new expired_context(0, (object) $record);
1984
        $purpose = new expired_context(0, (object) $record);
Línea 1985... Línea 1985...
1985
 
1985
 
1986
        $this->assertEquals($expected, $purpose->is_fully_expired());
1986
        $this->assertEquals($expected, $purpose->is_fully_expired());
Línea 2020... Línea 2020...
2020
    }
2020
    }
Línea 2021... Línea 2021...
2021
 
2021
 
2022
    /**
2022
    /**
2023
     * Ensure that any orphaned records are removed once the context has been removed.
2023
     * Ensure that any orphaned records are removed once the context has been removed.
2024
     */
2024
     */
2025
    public function test_orphaned_records_are_cleared() {
2025
    public function test_orphaned_records_are_cleared(): void {
Línea 2026... Línea 2026...
2026
        $this->resetAfterTest();
2026
        $this->resetAfterTest();
Línea 2027... Línea 2027...
2027
 
2027
 
Línea 2071... Línea 2071...
2071
    }
2071
    }
Línea 2072... Línea 2072...
2072
 
2072
 
2073
    /**
2073
    /**
2074
     * Ensure that the progres tracer works as expected out of the box.
2074
     * Ensure that the progres tracer works as expected out of the box.
2075
     */
2075
     */
2076
    public function test_progress_tracer_default() {
2076
    public function test_progress_tracer_default(): void {
Línea 2077... Línea 2077...
2077
        $manager = new \tool_dataprivacy\expired_contexts_manager();
2077
        $manager = new \tool_dataprivacy\expired_contexts_manager();
2078
 
2078
 
Línea 2083... Línea 2083...
2083
    }
2083
    }
Línea 2084... Línea 2084...
2084
 
2084
 
2085
    /**
2085
    /**
2086
     * Ensure that the progres tracer works as expected when given a specific traer.
2086
     * Ensure that the progres tracer works as expected when given a specific traer.
2087
     */
2087
     */
2088
    public function test_progress_tracer_set() {
2088
    public function test_progress_tracer_set(): void {
2089
        $manager = new \tool_dataprivacy\expired_contexts_manager();
2089
        $manager = new \tool_dataprivacy\expired_contexts_manager();
2090
        $mytrace = new \null_progress_trace();
2090
        $mytrace = new \null_progress_trace();
Línea 2091... Línea 2091...
2091
        $manager->set_progress($mytrace);
2091
        $manager->set_progress($mytrace);
Línea 2162... Línea 2162...
2162
    }
2162
    }
Línea 2163... Línea 2163...
2163
 
2163
 
2164
    /**
2164
    /**
2165
     * Test the is_context_expired functions when supplied with the system context.
2165
     * Test the is_context_expired functions when supplied with the system context.
2166
     */
2166
     */
2167
    public function test_is_context_expired_system() {
2167
    public function test_is_context_expired_system(): void {
2168
        $this->resetAfterTest();
2168
        $this->resetAfterTest();
2169
        $this->setup_basics('PT1H', 'PT1H', 'P1D');
2169
        $this->setup_basics('PT1H', 'PT1H', 'P1D');
Línea 2170... Línea 2170...
2170
        $user = $this->getDataGenerator()->create_user(['lastaccess' => time() - YEARSECS]);
2170
        $user = $this->getDataGenerator()->create_user(['lastaccess' => time() - YEARSECS]);
Línea 2178... Línea 2178...
2178
     * Test the is_context_expired functions when supplied with a block in the user context.
2178
     * Test the is_context_expired functions when supplied with a block in the user context.
2179
     *
2179
     *
2180
     * Children of a user context always follow the user expiry rather than any context level defaults (e.g. at the
2180
     * Children of a user context always follow the user expiry rather than any context level defaults (e.g. at the
2181
     * block level.
2181
     * block level.
2182
     */
2182
     */
2183
    public function test_is_context_expired_user_block() {
2183
    public function test_is_context_expired_user_block(): void {
2184
        $this->resetAfterTest();
2184
        $this->resetAfterTest();
Línea 2185... Línea 2185...
2185
 
2185
 
2186
        $purposes = $this->setup_basics('PT1H', 'PT1H', 'P1D');
2186
        $purposes = $this->setup_basics('PT1H', 'PT1H', 'P1D');
Línea 2203... Línea 2203...
2203
    }
2203
    }
Línea 2204... Línea 2204...
2204
 
2204
 
2205
    /**
2205
    /**
2206
     * Test the is_context_expired functions when supplied with the front page course.
2206
     * Test the is_context_expired functions when supplied with the front page course.
2207
     */
2207
     */
2208
    public function test_is_context_expired_frontpage() {
2208
    public function test_is_context_expired_frontpage(): void {
Línea 2209... Línea 2209...
2209
        $this->resetAfterTest();
2209
        $this->resetAfterTest();
Línea 2210... Línea 2210...
2210
 
2210
 
Línea 2237... Línea 2237...
2237
    }
2237
    }
Línea 2238... Línea 2238...
2238
 
2238
 
2239
    /**
2239
    /**
2240
     * Test the is_context_expired functions when supplied with an expired course.
2240
     * Test the is_context_expired functions when supplied with an expired course.
2241
     */
2241
     */
2242
    public function test_is_context_expired_course_expired() {
2242
    public function test_is_context_expired_course_expired(): void {
Línea 2243... Línea 2243...
2243
        $this->resetAfterTest();
2243
        $this->resetAfterTest();
Línea 2244... Línea 2244...
2244
 
2244
 
Línea 2260... Línea 2260...
2260
    }
2260
    }
Línea 2261... Línea 2261...
2261
 
2261
 
2262
    /**
2262
    /**
2263
     * Test the is_context_expired functions when supplied with an unexpired course.
2263
     * Test the is_context_expired functions when supplied with an unexpired course.
2264
     */
2264
     */
2265
    public function test_is_context_expired_course_unexpired() {
2265
    public function test_is_context_expired_course_unexpired(): void {
Línea 2266... Línea 2266...
2266
        $this->resetAfterTest();
2266
        $this->resetAfterTest();
Línea 2267... Línea 2267...
2267
 
2267
 
Línea 2289... Línea 2289...
2289
     * course.
2289
     * course.
2290
     *
2290
     *
2291
     * If the course is still within the expiry period for the child context, then that child's protected flag should be
2291
     * If the course is still within the expiry period for the child context, then that child's protected flag should be
2292
     * respected, even when the course may have expired.
2292
     * respected, even when the course may have expired.
2293
     */
2293
     */
2294
    public function test_is_child_context_expired_course_unexpired_with_child() {
2294
    public function test_is_child_context_expired_course_unexpired_with_child(): void {
2295
        $this->resetAfterTest();
2295
        $this->resetAfterTest();
Línea 2296... Línea 2296...
2296
 
2296
 
2297
        $purposes = $this->setup_basics('PT1H', 'PT1H', 'P1D', 'P1D');
2297
        $purposes = $this->setup_basics('PT1H', 'PT1H', 'P1D', 'P1D');
2298
        $purposes->course->set('protected', 0)->save();
2298
        $purposes->course->set('protected', 0)->save();
Línea 2319... Línea 2319...
2319
    }
2319
    }
Línea 2320... Línea 2320...
2320
 
2320
 
2321
    /**
2321
    /**
2322
     * Test the is_context_expired functions when supplied with an expired course which has role overrides.
2322
     * Test the is_context_expired functions when supplied with an expired course which has role overrides.
2323
     */
2323
     */
2324
    public function test_is_context_expired_course_expired_override() {
2324
    public function test_is_context_expired_course_expired_override(): void {
Línea 2325... Línea 2325...
2325
        global $DB;
2325
        global $DB;
Línea 2326... Línea 2326...
2326
 
2326
 
Línea 2354... Línea 2354...
2354
    }
2354
    }
Línea 2355... Línea 2355...
2355
 
2355
 
2356
    /**
2356
    /**
2357
     * Test the is_context_expired functions when supplied with an expired course which has role overrides.
2357
     * Test the is_context_expired functions when supplied with an expired course which has role overrides.
2358
     */
2358
     */
2359
    public function test_is_context_expired_course_expired_override_parent() {
2359
    public function test_is_context_expired_course_expired_override_parent(): void {
Línea 2360... Línea 2360...
2360
        global $DB;
2360
        global $DB;
Línea 2361... Línea 2361...
2361
 
2361
 
Línea 2403... Línea 2403...
2403
 
2403
 
2404
    /**
2404
    /**
2405
     * Test the is_context_expired functions when supplied with an expired course which has role overrides but the user
2405
     * Test the is_context_expired functions when supplied with an expired course which has role overrides but the user
2406
     * does not hold the role.
2406
     * does not hold the role.
2407
     */
2407
     */
2408
    public function test_is_context_expired_course_expired_override_parent_no_role() {
2408
    public function test_is_context_expired_course_expired_override_parent_no_role(): void {
Línea 2409... Línea 2409...
2409
        global $DB;
2409
        global $DB;
Línea 2410... Línea 2410...
2410
 
2410
 
Línea 2432... Línea 2432...
2432
    }
2432
    }
Línea 2433... Línea 2433...
2433
 
2433
 
2434
    /**
2434
    /**
2435
     * Test the is_context_expired functions when supplied with an unexpired course which has role overrides.
2435
     * Test the is_context_expired functions when supplied with an unexpired course which has role overrides.
2436
     */
2436
     */
2437
    public function test_is_context_expired_course_expired_override_inverse() {
2437
    public function test_is_context_expired_course_expired_override_inverse(): void {
Línea 2438... Línea 2438...
2438
        global $DB;
2438
        global $DB;
Línea 2439... Línea 2439...
2439
 
2439
 
Línea 2461... Línea 2461...
2461
    }
2461
    }
Línea 2462... Línea 2462...
2462
 
2462
 
2463
    /**
2463
    /**
2464
     * Test the is_context_expired functions when supplied with an unexpired course which has role overrides.
2464
     * Test the is_context_expired functions when supplied with an unexpired course which has role overrides.
2465
     */
2465
     */
2466
    public function test_is_context_expired_course_expired_override_inverse_parent() {
2466
    public function test_is_context_expired_course_expired_override_inverse_parent(): void {
Línea 2467... Línea 2467...
2467
        global $DB;
2467
        global $DB;
Línea 2468... Línea 2468...
2468
 
2468
 
Línea 2494... Línea 2494...
2494
    }
2494
    }
Línea 2495... Línea 2495...
2495
 
2495
 
2496
    /**
2496
    /**
2497
     * Test the is_context_expired functions when supplied with an unexpired course which has role overrides.
2497
     * Test the is_context_expired functions when supplied with an unexpired course which has role overrides.
2498
     */
2498
     */
2499
    public function test_is_context_expired_course_expired_override_inverse_parent_not_assigned() {
2499
    public function test_is_context_expired_course_expired_override_inverse_parent_not_assigned(): void {
Línea 2500... Línea 2500...
2500
        global $DB;
2500
        global $DB;
Línea 2501... Línea 2501...
2501
 
2501
 
Línea 2526... Línea 2526...
2526
    }
2526
    }
Línea 2527... Línea 2527...
2527
 
2527
 
2528
    /**
2528
    /**
2529
     * Ensure that context expired checks for a specific user taken into account roles.
2529
     * Ensure that context expired checks for a specific user taken into account roles.
2530
     */
2530
     */
2531
    public function test_is_context_expired_or_unprotected_for_user_role_mixtures_protected() {
2531
    public function test_is_context_expired_or_unprotected_for_user_role_mixtures_protected(): void {
Línea 2532... Línea 2532...
2532
        global $DB;
2532
        global $DB;
Línea 2533... Línea 2533...
2533
 
2533
 
Línea 2581... Línea 2581...
2581
    }
2581
    }
Línea 2582... Línea 2582...
2582
 
2582
 
2583
    /**
2583
    /**
2584
     * Ensure that context expired checks for a specific user taken into account roles when retention is inversed.
2584
     * Ensure that context expired checks for a specific user taken into account roles when retention is inversed.
2585
     */
2585
     */
2586
    public function test_is_context_expired_or_unprotected_for_user_role_mixtures_protected_inverse() {
2586
    public function test_is_context_expired_or_unprotected_for_user_role_mixtures_protected_inverse(): void {
Línea 2587... Línea 2587...
2587
        global $DB;
2587
        global $DB;
Línea 2588... Línea 2588...
2588
 
2588