Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 46... Línea 46...
46
class external_test extends externallib_advanced_testcase {
46
class external_test extends externallib_advanced_testcase {
Línea 47... Línea 47...
47
 
47
 
48
    /**
48
    /**
49
     * Test for external::approve_data_request() with the user not logged in.
49
     * Test for external::approve_data_request() with the user not logged in.
50
     */
50
     */
51
    public function test_approve_data_request_not_logged_in() {
51
    public function test_approve_data_request_not_logged_in(): void {
Línea 52... Línea 52...
52
        $this->resetAfterTest();
52
        $this->resetAfterTest();
53
 
53
 
54
        $generator = new \testing_data_generator();
54
        $generator = new \testing_data_generator();
Línea 67... Línea 67...
67
    }
67
    }
Línea 68... Línea 68...
68
 
68
 
69
    /**
69
    /**
70
     * Test for external::approve_data_request() with the user not having a DPO role.
70
     * Test for external::approve_data_request() with the user not having a DPO role.
71
     */
71
     */
72
    public function test_approve_data_request_not_dpo() {
72
    public function test_approve_data_request_not_dpo(): void {
Línea 73... Línea 73...
73
        $this->resetAfterTest();
73
        $this->resetAfterTest();
74
 
74
 
75
        $generator = new \testing_data_generator();
75
        $generator = new \testing_data_generator();
Línea 87... Línea 87...
87
    }
87
    }
Línea 88... Línea 88...
88
 
88
 
89
    /**
89
    /**
90
     * Test for external::approve_data_request() for request that's not ready for approval
90
     * Test for external::approve_data_request() for request that's not ready for approval
91
     */
91
     */
92
    public function test_approve_data_request_not_waiting_for_approval() {
92
    public function test_approve_data_request_not_waiting_for_approval(): void {
Línea 93... Línea 93...
93
        $this->resetAfterTest();
93
        $this->resetAfterTest();
94
 
94
 
95
        $generator = new \testing_data_generator();
95
        $generator = new \testing_data_generator();
Línea 108... Línea 108...
108
    }
108
    }
Línea 109... Línea 109...
109
 
109
 
110
    /**
110
    /**
111
     * Test for external::approve_data_request()
111
     * Test for external::approve_data_request()
112
     */
112
     */
113
    public function test_approve_data_request() {
113
    public function test_approve_data_request(): void {
Línea 114... Línea 114...
114
        $this->resetAfterTest();
114
        $this->resetAfterTest();
115
 
115
 
116
        $generator = new \testing_data_generator();
116
        $generator = new \testing_data_generator();
Línea 131... Línea 131...
131
    }
131
    }
Línea 132... Línea 132...
132
 
132
 
133
    /**
133
    /**
134
     * Test for external::approve_data_request() for a non-existent request ID.
134
     * Test for external::approve_data_request() for a non-existent request ID.
135
     */
135
     */
136
    public function test_approve_data_request_non_existent() {
136
    public function test_approve_data_request_non_existent(): void {
Línea 137... Línea 137...
137
        $this->resetAfterTest();
137
        $this->resetAfterTest();
138
 
138
 
Línea 149... Línea 149...
149
    }
149
    }
Línea 150... Línea 150...
150
 
150
 
151
    /**
151
    /**
152
     * Test for external::cancel_data_request() of another user.
152
     * Test for external::cancel_data_request() of another user.
153
     */
153
     */
154
    public function test_cancel_data_request_other_user() {
154
    public function test_cancel_data_request_other_user(): void {
Línea 155... Línea 155...
155
        $this->resetAfterTest();
155
        $this->resetAfterTest();
156
 
156
 
157
        $generator = new \testing_data_generator();
157
        $generator = new \testing_data_generator();
Línea 175... Línea 175...
175
    }
175
    }
Línea 176... Línea 176...
176
 
176
 
177
    /**
177
    /**
178
     * Test cancellation of a request where you are the requester of another user's data.
178
     * Test cancellation of a request where you are the requester of another user's data.
179
     */
179
     */
180
    public function test_cancel_data_request_other_user_as_requester() {
180
    public function test_cancel_data_request_other_user_as_requester(): void {
Línea 181... Línea 181...
181
        $this->resetAfterTest();
181
        $this->resetAfterTest();
182
 
182
 
183
        $generator = new \testing_data_generator();
183
        $generator = new \testing_data_generator();
Línea 202... Línea 202...
202
    }
202
    }
Línea 203... Línea 203...
203
 
203
 
204
    /**
204
    /**
205
     * Test cancellation of a request where you are the requester of another user's data.
205
     * Test cancellation of a request where you are the requester of another user's data.
206
     */
206
     */
207
    public function test_cancel_data_request_requester_lost_permissions() {
207
    public function test_cancel_data_request_requester_lost_permissions(): void {
Línea 208... Línea 208...
208
        $this->resetAfterTest();
208
        $this->resetAfterTest();
209
 
209
 
210
        $generator = new \testing_data_generator();
210
        $generator = new \testing_data_generator();
Línea 231... Línea 231...
231
    }
231
    }
Línea 232... Línea 232...
232
 
232
 
233
    /**
233
    /**
234
     * Test cancellation of a request where you are the requester of another user's data.
234
     * Test cancellation of a request where you are the requester of another user's data.
235
     */
235
     */
236
    public function test_cancel_data_request_other_user_as_child() {
236
    public function test_cancel_data_request_other_user_as_child(): void {
Línea 237... Línea 237...
237
        $this->resetAfterTest();
237
        $this->resetAfterTest();
238
 
238
 
239
        $generator = new \testing_data_generator();
239
        $generator = new \testing_data_generator();
Línea 258... Línea 258...
258
    }
258
    }
Línea 259... Línea 259...
259
 
259
 
260
    /**
260
    /**
261
     * Test for external::cancel_data_request()
261
     * Test for external::cancel_data_request()
262
     */
262
     */
263
    public function test_cancel_data_request() {
263
    public function test_cancel_data_request(): void {
Línea 264... Línea 264...
264
        $this->resetAfterTest();
264
        $this->resetAfterTest();
265
 
265
 
266
        $generator = new \testing_data_generator();
266
        $generator = new \testing_data_generator();
Línea 281... Línea 281...
281
    }
281
    }
Línea 282... Línea 282...
282
 
282
 
283
    /**
283
    /**
284
     * Test contact DPO.
284
     * Test contact DPO.
285
     */
285
     */
286
    public function test_contact_dpo() {
286
    public function test_contact_dpo(): void {
Línea 287... Línea 287...
287
        $this->resetAfterTest();
287
        $this->resetAfterTest();
288
 
288
 
Línea 298... Línea 298...
298
    }
298
    }
Línea 299... Línea 299...
299
 
299
 
300
    /**
300
    /**
301
     * Test contact DPO with message containing invalid input.
301
     * Test contact DPO with message containing invalid input.
302
     */
302
     */
303
    public function test_contact_dpo_with_nasty_input() {
303
    public function test_contact_dpo_with_nasty_input(): void {
Línea 304... Línea 304...
304
        $this->resetAfterTest();
304
        $this->resetAfterTest();
305
 
305
 
Línea 312... Línea 312...
312
    }
312
    }
Línea 313... Línea 313...
313
 
313
 
314
    /**
314
    /**
315
     * Test for external::deny_data_request() with the user not logged in.
315
     * Test for external::deny_data_request() with the user not logged in.
316
     */
316
     */
317
    public function test_deny_data_request_not_logged_in() {
317
    public function test_deny_data_request_not_logged_in(): void {
Línea 318... Línea 318...
318
        $this->resetAfterTest();
318
        $this->resetAfterTest();
319
 
319
 
320
        $generator = new \testing_data_generator();
320
        $generator = new \testing_data_generator();
Línea 332... Línea 332...
332
    }
332
    }
Línea 333... Línea 333...
333
 
333
 
334
    /**
334
    /**
335
     * Test for external::deny_data_request() with the user not having a DPO role.
335
     * Test for external::deny_data_request() with the user not having a DPO role.
336
     */
336
     */
337
    public function test_deny_data_request_not_dpo() {
337
    public function test_deny_data_request_not_dpo(): void {
Línea 338... Línea 338...
338
        $this->resetAfterTest();
338
        $this->resetAfterTest();
339
 
339
 
340
        $generator = new \testing_data_generator();
340
        $generator = new \testing_data_generator();
Línea 351... Línea 351...
351
    }
351
    }
Línea 352... Línea 352...
352
 
352
 
353
    /**
353
    /**
354
     * Test for external::deny_data_request() for request that's not ready for approval
354
     * Test for external::deny_data_request() for request that's not ready for approval
355
     */
355
     */
356
    public function test_deny_data_request_not_waiting_for_approval() {
356
    public function test_deny_data_request_not_waiting_for_approval(): void {
Línea 357... Línea 357...
357
        $this->resetAfterTest();
357
        $this->resetAfterTest();
358
 
358
 
359
        $generator = new \testing_data_generator();
359
        $generator = new \testing_data_generator();
Línea 371... Línea 371...
371
    }
371
    }
Línea 372... Línea 372...
372
 
372
 
373
    /**
373
    /**
374
     * Test for external::deny_data_request()
374
     * Test for external::deny_data_request()
375
     */
375
     */
376
    public function test_deny_data_request() {
376
    public function test_deny_data_request(): void {
Línea 377... Línea 377...
377
        $this->resetAfterTest();
377
        $this->resetAfterTest();
378
 
378
 
379
        $generator = new \testing_data_generator();
379
        $generator = new \testing_data_generator();
Línea 393... Línea 393...
393
    }
393
    }
Línea 394... Línea 394...
394
 
394
 
395
    /**
395
    /**
396
     * Test for external::deny_data_request() for a non-existent request ID.
396
     * Test for external::deny_data_request() for a non-existent request ID.
397
     */
397
     */
398
    public function test_deny_data_request_non_existent() {
398
    public function test_deny_data_request_non_existent(): void {
Línea 399... Línea 399...
399
        $this->resetAfterTest();
399
        $this->resetAfterTest();
400
 
400
 
401
        // Admin as DPO. (The default when no one's assigned as a DPO in the site).
401
        // Admin as DPO. (The default when no one's assigned as a DPO in the site).
Línea 410... Línea 410...
410
    }
410
    }
Línea 411... Línea 411...
411
 
411
 
412
    /**
412
    /**
413
     * Test for external::get_data_request() with the user not logged in.
413
     * Test for external::get_data_request() with the user not logged in.
414
     */
414
     */
415
    public function test_get_data_request_not_logged_in() {
415
    public function test_get_data_request_not_logged_in(): void {
Línea 416... Línea 416...
416
        $this->resetAfterTest();
416
        $this->resetAfterTest();
417
 
417
 
418
        $generator = new \testing_data_generator();
418
        $generator = new \testing_data_generator();
Línea 428... Línea 428...
428
    }
428
    }
Línea 429... Línea 429...
429
 
429
 
430
    /**
430
    /**
431
     * Test for external::get_data_request() with the user not having a DPO role.
431
     * Test for external::get_data_request() with the user not having a DPO role.
432
     */
432
     */
433
    public function test_get_data_request_not_dpo() {
433
    public function test_get_data_request_not_dpo(): void {
Línea 434... Línea 434...
434
        $this->resetAfterTest();
434
        $this->resetAfterTest();
435
 
435
 
436
        $generator = new \testing_data_generator();
436
        $generator = new \testing_data_generator();
Línea 448... Línea 448...
448
    }
448
    }
Línea 449... Línea 449...
449
 
449
 
450
    /**
450
    /**
451
     * Test for external::get_data_request()
451
     * Test for external::get_data_request()
452
     */
452
     */
453
    public function test_get_data_request() {
453
    public function test_get_data_request(): void {
Línea 454... Línea 454...
454
        $this->resetAfterTest();
454
        $this->resetAfterTest();
455
 
455
 
456
        $generator = new \testing_data_generator();
456
        $generator = new \testing_data_generator();
Línea 473... Línea 473...
473
    }
473
    }
Línea 474... Línea 474...
474
 
474
 
475
    /**
475
    /**
476
     * Test for external::get_data_request() for a non-existent request ID.
476
     * Test for external::get_data_request() for a non-existent request ID.
477
     */
477
     */
478
    public function test_get_data_request_non_existent() {
478
    public function test_get_data_request_non_existent(): void {
Línea 479... Línea 479...
479
        $this->resetAfterTest();
479
        $this->resetAfterTest();
480
 
480
 
481
        // Admin as DPO. (The default when no one's assigned as a DPO in the site).
481
        // Admin as DPO. (The default when no one's assigned as a DPO in the site).
Línea 486... Línea 486...
486
 
486
 
487
    /**
487
    /**
488
     * Test for \tool_dataprivacy\external::set_context_defaults()
488
     * Test for \tool_dataprivacy\external::set_context_defaults()
489
     * when called by a user that doesn't have the manage registry capability.
489
     * when called by a user that doesn't have the manage registry capability.
490
     */
490
     */
491
    public function test_set_context_defaults_no_capability() {
491
    public function test_set_context_defaults_no_capability(): void {
Línea 492... Línea 492...
492
        $this->resetAfterTest();
492
        $this->resetAfterTest();
493
 
493
 
494
        $generator = $this->getDataGenerator();
494
        $generator = $this->getDataGenerator();
Línea 506... Línea 506...
506
     *
506
     *
507
     * @dataProvider get_options_provider
507
     * @dataProvider get_options_provider
508
     * @param bool $modulelevel Whether defaults are to be applied on the module context level or for an activity only.
508
     * @param bool $modulelevel Whether defaults are to be applied on the module context level or for an activity only.
509
     * @param bool $override Whether to override instances.
509
     * @param bool $override Whether to override instances.
510
     */
510
     */
511
    public function test_set_context_defaults($modulelevel, $override) {
511
    public function test_set_context_defaults($modulelevel, $override): void {
512
        $this->resetAfterTest();
512
        $this->resetAfterTest();
Línea 513... Línea 513...
513
 
513
 
514
        $this->setAdminUser();
514
        $this->setAdminUser();
Línea 565... Línea 565...
565
 
565
 
566
    /**
566
    /**
567
     * Test for \tool_dataprivacy\external::get_category_options()
567
     * Test for \tool_dataprivacy\external::get_category_options()
568
     * when called by a user that doesn't have the manage registry capability.
568
     * when called by a user that doesn't have the manage registry capability.
569
     */
569
     */
570
    public function test_get_category_options_no_capability() {
570
    public function test_get_category_options_no_capability(): void {
Línea 571... Línea 571...
571
        $this->resetAfterTest();
571
        $this->resetAfterTest();
572
 
572
 
Línea 594... Línea 594...
594
     *
594
     *
595
     * @dataProvider get_options_provider
595
     * @dataProvider get_options_provider
596
     * @param bool $includeinherit Whether "Inherit" would be included to the options.
596
     * @param bool $includeinherit Whether "Inherit" would be included to the options.
597
     * @param bool $includenotset Whether "Not set" would be included to the options.
597
     * @param bool $includenotset Whether "Not set" would be included to the options.
598
     */
598
     */
599
    public function test_get_category_options($includeinherit, $includenotset) {
599
    public function test_get_category_options($includeinherit, $includenotset): void {
600
        $this->resetAfterTest();
600
        $this->resetAfterTest();
601
        $this->setAdminUser();
601
        $this->setAdminUser();
Línea 602... Línea 602...
602
 
602
 
603
        // Prepare our expected options.
603
        // Prepare our expected options.
Línea 640... Línea 640...
640
 
640
 
641
    /**
641
    /**
642
     * Test for \tool_dataprivacy\external::get_purpose_options()
642
     * Test for \tool_dataprivacy\external::get_purpose_options()
643
     * when called by a user that doesn't have the manage registry capability.
643
     * when called by a user that doesn't have the manage registry capability.
644
     */
644
     */
645
    public function test_get_purpose_options_no_capability() {
645
    public function test_get_purpose_options_no_capability(): void {
646
        $this->resetAfterTest();
646
        $this->resetAfterTest();
647
        $generator = $this->getDataGenerator();
647
        $generator = $this->getDataGenerator();
648
        $user = $generator->create_user();
648
        $user = $generator->create_user();
649
        $this->setUser($user);
649
        $this->setUser($user);
Línea 656... Línea 656...
656
     *
656
     *
657
     * @dataProvider get_options_provider
657
     * @dataProvider get_options_provider
658
     * @param bool $includeinherit Whether "Inherit" would be included to the options.
658
     * @param bool $includeinherit Whether "Inherit" would be included to the options.
659
     * @param bool $includenotset Whether "Not set" would be included to the options.
659
     * @param bool $includenotset Whether "Not set" would be included to the options.
660
     */
660
     */
661
    public function test_get_purpose_options($includeinherit, $includenotset) {
661
    public function test_get_purpose_options($includeinherit, $includenotset): void {
662
        $this->resetAfterTest();
662
        $this->resetAfterTest();
663
        $this->setAdminUser();
663
        $this->setAdminUser();
Línea 664... Línea 664...
664
 
664
 
665
        // Prepare our expected options.
665
        // Prepare our expected options.
Línea 724... Línea 724...
724
     * @dataProvider get_activity_options_provider
724
     * @dataProvider get_activity_options_provider
725
     * @param bool $inheritcategory Whether the category would be set to "Inherit".
725
     * @param bool $inheritcategory Whether the category would be set to "Inherit".
726
     * @param bool $inheritpurpose Whether the purpose would be set to "Inherit".
726
     * @param bool $inheritpurpose Whether the purpose would be set to "Inherit".
727
     * @param bool $nodefaults Whether to fetch only activities that don't have defaults.
727
     * @param bool $nodefaults Whether to fetch only activities that don't have defaults.
728
     */
728
     */
729
    public function test_get_activity_options($inheritcategory, $inheritpurpose, $nodefaults) {
729
    public function test_get_activity_options($inheritcategory, $inheritpurpose, $nodefaults): void {
730
        $this->resetAfterTest();
730
        $this->resetAfterTest();
731
        $this->setAdminUser();
731
        $this->setAdminUser();
Línea 732... Línea 732...
732
 
732
 
733
        $category = api::create_category((object)['name' => 'Test category']);
733
        $category = api::create_category((object)['name' => 'Test category']);
Línea 772... Línea 772...
772
    }
772
    }
Línea 773... Línea 773...
773
 
773
 
774
    /**
774
    /**
775
     * Test for external::bulk_approve_data_requests().
775
     * Test for external::bulk_approve_data_requests().
776
     */
776
     */
777
    public function test_bulk_approve_data_requests() {
777
    public function test_bulk_approve_data_requests(): void {
Línea 778... Línea 778...
778
        $this->resetAfterTest();
778
        $this->resetAfterTest();
779
 
779
 
780
        // Create delete data requests.
780
        // Create delete data requests.
Línea 800... Línea 800...
800
    }
800
    }
Línea 801... Línea 801...
801
 
801
 
802
    /**
802
    /**
803
     * Test for external::bulk_approve_data_requests() for a non-existent request ID.
803
     * Test for external::bulk_approve_data_requests() for a non-existent request ID.
804
     */
804
     */
805
    public function test_bulk_approve_data_requests_non_existent() {
805
    public function test_bulk_approve_data_requests_non_existent(): void {
Línea 806... Línea 806...
806
        $this->resetAfterTest();
806
        $this->resetAfterTest();
Línea 807... Línea 807...
807
 
807
 
Línea 818... Línea 818...
818
    }
818
    }
Línea 819... Línea 819...
819
 
819
 
820
    /**
820
    /**
821
     * Test for external::bulk_deny_data_requests() for a user without permission to deny requests.
821
     * Test for external::bulk_deny_data_requests() for a user without permission to deny requests.
822
     */
822
     */
823
    public function test_bulk_approve_data_requests_no_permission() {
823
    public function test_bulk_approve_data_requests_no_permission(): void {
Línea 824... Línea 824...
824
        $this->resetAfterTest();
824
        $this->resetAfterTest();
825
 
825
 
826
        // Create delete data requests.
826
        // Create delete data requests.
Línea 847... Línea 847...
847
    }
847
    }
Línea 848... Línea 848...
848
 
848
 
849
    /**
849
    /**
850
     * Test for external::bulk_deny_data_requests() for a user without permission to deny requests.
850
     * Test for external::bulk_deny_data_requests() for a user without permission to deny requests.
851
     */
851
     */
852
    public function test_bulk_approve_data_requests_own_request() {
852
    public function test_bulk_approve_data_requests_own_request(): void {
Línea 853... Línea 853...
853
        $this->resetAfterTest();
853
        $this->resetAfterTest();
854
 
854
 
855
        // Create delete data requests.
855
        // Create delete data requests.
Línea 875... Línea 875...
875
    }
875
    }
Línea 876... Línea 876...
876
 
876
 
877
    /**
877
    /**
878
     * Test for external::bulk_deny_data_requests().
878
     * Test for external::bulk_deny_data_requests().
879
     */
879
     */
880
    public function test_bulk_deny_data_requests() {
880
    public function test_bulk_deny_data_requests(): void {
Línea 881... Línea 881...
881
        $this->resetAfterTest();
881
        $this->resetAfterTest();
882
 
882
 
883
        // Create delete data requests.
883
        // Create delete data requests.
Línea 903... Línea 903...
903
    }
903
    }
Línea 904... Línea 904...
904
 
904
 
905
    /**
905
    /**
906
     * Test for external::bulk_deny_data_requests() for a non-existent request ID.
906
     * Test for external::bulk_deny_data_requests() for a non-existent request ID.
907
     */
907
     */
908
    public function test_bulk_deny_data_requests_non_existent() {
908
    public function test_bulk_deny_data_requests_non_existent(): void {
Línea 909... Línea 909...
909
        $this->resetAfterTest();
909
        $this->resetAfterTest();
910
 
910
 
911
        $this->setAdminUser();
911
        $this->setAdminUser();
Línea 920... Línea 920...
920
    }
920
    }
Línea 921... Línea 921...
921
 
921
 
922
    /**
922
    /**
923
     * Test for external::bulk_deny_data_requests() for a user without permission to deny requests.
923
     * Test for external::bulk_deny_data_requests() for a user without permission to deny requests.
924
     */
924
     */
925
    public function test_bulk_deny_data_requests_no_permission() {
925
    public function test_bulk_deny_data_requests_no_permission(): void {
Línea 926... Línea 926...
926
        $this->resetAfterTest();
926
        $this->resetAfterTest();
927
 
927
 
928
        // Create delete data requests.
928
        // Create delete data requests.
Línea 949... Línea 949...
949
    }
949
    }
Línea 950... Línea 950...
950
 
950
 
951
    /**
951
    /**
952
     * Test for external::bulk_deny_data_requests() for a user cannot approve their own request.
952
     * Test for external::bulk_deny_data_requests() for a user cannot approve their own request.
953
     */
953
     */
954
    public function test_bulk_deny_data_requests_own_request() {
954
    public function test_bulk_deny_data_requests_own_request(): void {
Línea 955... Línea 955...
955
        $this->resetAfterTest();
955
        $this->resetAfterTest();
956
 
956
 
957
        // Create delete data requests.
957
        // Create delete data requests.
Línea 984... Línea 984...
984
     * @throws dml_exception
984
     * @throws dml_exception
985
     * @throws invalid_parameter_exception
985
     * @throws invalid_parameter_exception
986
     * @throws required_capability_exception
986
     * @throws required_capability_exception
987
     * @throws restricted_context_exception
987
     * @throws restricted_context_exception
988
     */
988
     */
989
    public function test_get_users_using_using_non_identity() {
989
    public function test_get_users_using_using_non_identity(): void {
990
        $this->resetAfterTest();
990
        $this->resetAfterTest();
991
        $context = \context_system::instance();
991
        $context = \context_system::instance();
992
        $requester = $this->getDataGenerator()->create_user();
992
        $requester = $this->getDataGenerator()->create_user();
993
        $role = $this->getDataGenerator()->create_role();
993
        $role = $this->getDataGenerator()->create_role();
994
        role_assign($role, $requester->id, $context);
994
        role_assign($role, $requester->id, $context);
Línea 1019... Línea 1019...
1019
     * @throws dml_exception
1019
     * @throws dml_exception
1020
     * @throws invalid_parameter_exception
1020
     * @throws invalid_parameter_exception
1021
     * @throws required_capability_exception
1021
     * @throws required_capability_exception
1022
     * @throws restricted_context_exception
1022
     * @throws restricted_context_exception
1023
     */
1023
     */
1024
    public function test_get_users_using_identity_without_permission() {
1024
    public function test_get_users_using_identity_without_permission(): void {
1025
        global $CFG;
1025
        global $CFG;
Línea 1026... Línea 1026...
1026
 
1026
 
1027
        $this->resetAfterTest();
1027
        $this->resetAfterTest();
Línea 1051... Línea 1051...
1051
     * @throws dml_exception
1051
     * @throws dml_exception
1052
     * @throws invalid_parameter_exception
1052
     * @throws invalid_parameter_exception
1053
     * @throws required_capability_exception
1053
     * @throws required_capability_exception
1054
     * @throws restricted_context_exception
1054
     * @throws restricted_context_exception
1055
     */
1055
     */
1056
    public function test_get_users_using_field_not_in_identity() {
1056
    public function test_get_users_using_field_not_in_identity(): void {
1057
        $this->resetAfterTest();
1057
        $this->resetAfterTest();
Línea 1058... Línea 1058...
1058
 
1058
 
1059
        $context = \context_system::instance();
1059
        $context = \context_system::instance();
1060
        $requester = $this->getDataGenerator()->create_user();
1060
        $requester = $this->getDataGenerator()->create_user();
Línea 1080... Línea 1080...
1080
     * @throws dml_exception
1080
     * @throws dml_exception
1081
     * @throws invalid_parameter_exception
1081
     * @throws invalid_parameter_exception
1082
     * @throws required_capability_exception
1082
     * @throws required_capability_exception
1083
     * @throws restricted_context_exception
1083
     * @throws restricted_context_exception
1084
     */
1084
     */
1085
    public function test_get_users() {
1085
    public function test_get_users(): void {
1086
        global $CFG;
1086
        global $CFG;
1087
        $this->resetAfterTest();
1087
        $this->resetAfterTest();
1088
        $CFG->showuseridentity = 'institution';
1088
        $CFG->showuseridentity = 'institution';
1089
        $context = \context_system::instance();
1089
        $context = \context_system::instance();
1090
        $requester = $this->getDataGenerator()->create_user();
1090
        $requester = $this->getDataGenerator()->create_user();
Línea 1116... Línea 1116...
1116
    }
1116
    }
Línea 1117... Línea 1117...
1117
 
1117
 
1118
    /**
1118
    /**
1119
     * Test for external::get_access_information().
1119
     * Test for external::get_access_information().
1120
     */
1120
     */
1121
    public function test_get_access_information() {
1121
    public function test_get_access_information(): void {
Línea 1122... Línea 1122...
1122
        $this->resetAfterTest();
1122
        $this->resetAfterTest();
1123
 
1123
 
1124
        $this->setAdminUser();
1124
        $this->setAdminUser();
Línea 1143... Línea 1143...
1143
    }
1143
    }
Línea 1144... Línea 1144...
1144
 
1144
 
1145
    /**
1145
    /**
1146
     * Test for external::create_data_request()
1146
     * Test for external::create_data_request()
1147
     */
1147
     */
1148
    public function test_create_data_request() {
1148
    public function test_create_data_request(): void {
Línea 1149... Línea 1149...
1149
        $this->resetAfterTest();
1149
        $this->resetAfterTest();
1150
 
1150
 
1151
        $systemcontext = \context_system::instance();
1151
        $systemcontext = \context_system::instance();
Línea 1198... Línea 1198...
1198
    }
1198
    }
Línea 1199... Línea 1199...
1199
 
1199
 
1200
    /**
1200
    /**
1201
     * Test for external::create_data_request() when no dpo available.
1201
     * Test for external::create_data_request() when no dpo available.
1202
     */
1202
     */
1203
    public function test_create_data_request_no_dpo() {
1203
    public function test_create_data_request_no_dpo(): void {
Línea 1204... Línea 1204...
1204
        $this->resetAfterTest();
1204
        $this->resetAfterTest();
1205
 
1205
 
Línea 1212... Línea 1212...
1212
    }
1212
    }
Línea 1213... Línea 1213...
1213
 
1213
 
1214
    /**
1214
    /**
1215
     * Test for external::create_data_request() with missing permission.
1215
     * Test for external::create_data_request() with missing permission.
1216
     */
1216
     */
1217
    public function test_create_data_request_no_permission() {
1217
    public function test_create_data_request_no_permission(): void {
Línea 1218... Línea 1218...
1218
        $this->resetAfterTest();
1218
        $this->resetAfterTest();
1219
 
1219
 
Línea 1229... Línea 1229...
1229
    }
1229
    }
Línea 1230... Línea 1230...
1230
 
1230
 
1231
    /**
1231
    /**
1232
     * Test for external::create_data_request() with invalid request type.
1232
     * Test for external::create_data_request() with invalid request type.
1233
     */
1233
     */
1234
    public function test_create_data_request_invalid_type() {
1234
    public function test_create_data_request_invalid_type(): void {
Línea 1235... Línea 1235...
1235
        $this->resetAfterTest();
1235
        $this->resetAfterTest();
1236
 
1236
 
Línea 1246... Línea 1246...
1246
    }
1246
    }
Línea 1247... Línea 1247...
1247
 
1247
 
1248
    /**
1248
    /**
1249
     * Test for external::get_data_requests().
1249
     * Test for external::get_data_requests().
1250
     */
1250
     */
1251
    public function test_get_data_requests() {
1251
    public function test_get_data_requests(): void {
Línea 1252... Línea 1252...
1252
        global $DB;
1252
        global $DB;
Línea 1253... Línea 1253...
1253
 
1253
 
Línea 1353... Línea 1353...
1353
    }
1353
    }
Línea 1354... Línea 1354...
1354
 
1354
 
1355
    /**
1355
    /**
1356
     * Test for external::get_data_requests() invalid user id.
1356
     * Test for external::get_data_requests() invalid user id.
1357
     */
1357
     */
1358
    public function test_get_data_requests_invalid_userid() {
1358
    public function test_get_data_requests_invalid_userid(): void {
1359
        $this->resetAfterTest();
1359
        $this->resetAfterTest();
Línea 1360... Línea 1360...
1360
        $this->setAdminUser();
1360
        $this->setAdminUser();
1361
 
1361