Línea 62... |
Línea 62... |
62 |
/**
|
62 |
/**
|
63 |
* Test collection of metadata for components implementing a metadata provider.
|
63 |
* Test collection of metadata for components implementing a metadata provider.
|
64 |
*
|
64 |
*
|
65 |
* @covers ::get_metadata_for_components
|
65 |
* @covers ::get_metadata_for_components
|
66 |
*/
|
66 |
*/
|
67 |
public function test_get_metadata_for_components() {
|
67 |
public function test_get_metadata_for_components(): void {
|
68 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
68 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
69 |
// testcomponent is a core provider, testcomponent2 is a null provider, testcomponent3 is subplugin provider (non core).
|
69 |
// testcomponent is a core provider, testcomponent2 is a null provider, testcomponent3 is subplugin provider (non core).
|
70 |
$mockman = $this->get_mock_manager_with_core_components(['mod_testcomponent', 'mod_testcomponent2', 'mod_testcomponent3']);
|
70 |
$mockman = $this->get_mock_manager_with_core_components(['mod_testcomponent', 'mod_testcomponent2', 'mod_testcomponent3']);
|
Línea 71... |
Línea 71... |
71 |
|
71 |
|
Línea 85... |
Línea 85... |
85 |
/**
|
85 |
/**
|
86 |
* Test that get_contexts_for_userid() only returns contextlist collections for core providers.
|
86 |
* Test that get_contexts_for_userid() only returns contextlist collections for core providers.
|
87 |
*
|
87 |
*
|
88 |
* @covers ::get_contexts_for_userid
|
88 |
* @covers ::get_contexts_for_userid
|
89 |
*/
|
89 |
*/
|
90 |
public function test_get_contexts_for_userid() {
|
90 |
public function test_get_contexts_for_userid(): void {
|
91 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
91 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
92 |
// testcomponent is a core provider, testcomponent2 is a null provider, testcomponent3 is subplugin provider (non core).
|
92 |
// testcomponent is a core provider, testcomponent2 is a null provider, testcomponent3 is subplugin provider (non core).
|
93 |
$mockman = $this->get_mock_manager_with_core_components(['mod_testcomponent', 'mod_testcomponent2', 'mod_testcomponent3']);
|
93 |
$mockman = $this->get_mock_manager_with_core_components(['mod_testcomponent', 'mod_testcomponent2', 'mod_testcomponent3']);
|
Línea 94... |
Línea 94... |
94 |
|
94 |
|
Línea 112... |
Línea 112... |
112 |
/**
|
112 |
/**
|
113 |
* Test verifying the output of component_is_compliant.
|
113 |
* Test verifying the output of component_is_compliant.
|
114 |
*
|
114 |
*
|
115 |
* @covers ::component_is_compliant
|
115 |
* @covers ::component_is_compliant
|
116 |
*/
|
116 |
*/
|
117 |
public function test_component_is_compliant() {
|
117 |
public function test_component_is_compliant(): void {
|
118 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
118 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
119 |
// testcomponent is a core provider, testcomponent2 is a null provider, testcomponent3 is subplugin provider (non core).
|
119 |
// testcomponent is a core provider, testcomponent2 is a null provider, testcomponent3 is subplugin provider (non core).
|
120 |
$mockman = $this->get_mock_manager_with_core_components(['mod_testcomponent', 'mod_testcomponent2', 'mod_testcomponent3']);
|
120 |
$mockman = $this->get_mock_manager_with_core_components(['mod_testcomponent', 'mod_testcomponent2', 'mod_testcomponent3']);
|
Línea 121... |
Línea 121... |
121 |
|
121 |
|
Línea 158... |
Línea 158... |
158 |
* @dataProvider component_is_compliant_provider
|
158 |
* @dataProvider component_is_compliant_provider
|
159 |
* @param string $component
|
159 |
* @param string $component
|
160 |
* @param boolean $expected
|
160 |
* @param boolean $expected
|
161 |
* @covers ::component_is_compliant
|
161 |
* @covers ::component_is_compliant
|
162 |
*/
|
162 |
*/
|
163 |
public function test_component_is_compliant_examples($component, $expected) {
|
163 |
public function test_component_is_compliant_examples($component, $expected): void {
|
164 |
$manager = new \core_privacy\manager();
|
164 |
$manager = new \core_privacy\manager();
|
Línea 165... |
Línea 165... |
165 |
|
165 |
|
166 |
$this->assertEquals($expected, $manager->component_is_compliant($component));
|
166 |
$this->assertEquals($expected, $manager->component_is_compliant($component));
|
Línea 167... |
Línea 167... |
167 |
}
|
167 |
}
|
168 |
|
168 |
|
169 |
/**
|
169 |
/**
|
170 |
* Test verifying only approved contextlists can be used with the export_user_data method.
|
170 |
* Test verifying only approved contextlists can be used with the export_user_data method.
|
171 |
*
|
171 |
*
|
172 |
* @covers ::export_user_data
|
172 |
* @covers ::export_user_data
|
173 |
*/
|
173 |
*/
|
174 |
public function test_export_user_data() {
|
174 |
public function test_export_user_data(): void {
|
175 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
175 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
Línea 176... |
Línea 176... |
176 |
// testcomponent is a core provider, testcomponent2 is a null provider, testcomponent3 is subplugin provider (non core).
|
176 |
// testcomponent is a core provider, testcomponent2 is a null provider, testcomponent3 is subplugin provider (non core).
|
Línea 204... |
Línea 204... |
204 |
/**
|
204 |
/**
|
205 |
* Test verifying only approved contextlists can be used with the delete_data_for_user method.
|
205 |
* Test verifying only approved contextlists can be used with the delete_data_for_user method.
|
206 |
*
|
206 |
*
|
207 |
* @covers ::delete_data_for_user
|
207 |
* @covers ::delete_data_for_user
|
208 |
*/
|
208 |
*/
|
209 |
public function test_delete_data_for_user() {
|
209 |
public function test_delete_data_for_user(): void {
|
210 |
$this->resetAfterTest();
|
210 |
$this->resetAfterTest();
|
211 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
211 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
212 |
// testcomponent is a core provider, testcomponent2 is a null provider, testcomponent3 is subplugin provider (non core).
|
212 |
// testcomponent is a core provider, testcomponent2 is a null provider, testcomponent3 is subplugin provider (non core).
|
213 |
$mockman = $this->get_mock_manager_with_core_components(['mod_testcomponent', 'mod_testcomponent2', 'mod_testcomponent3']);
|
213 |
$mockman = $this->get_mock_manager_with_core_components(['mod_testcomponent', 'mod_testcomponent2', 'mod_testcomponent3']);
|
Línea 237... |
Línea 237... |
237 |
*
|
237 |
*
|
238 |
* This really just checks that all providers can be safely autoloaded.
|
238 |
* This really just checks that all providers can be safely autoloaded.
|
239 |
*
|
239 |
*
|
240 |
* @covers ::get_metadata_for_components
|
240 |
* @covers ::get_metadata_for_components
|
241 |
*/
|
241 |
*/
|
242 |
public function test_installed_plugins() {
|
242 |
public function test_installed_plugins(): void {
|
243 |
$manager = new \core_privacy\manager();
|
243 |
$manager = new \core_privacy\manager();
|
244 |
$metadata = $manager->get_metadata_for_components();
|
244 |
$metadata = $manager->get_metadata_for_components();
|
245 |
$this->assertNotEmpty($metadata);
|
245 |
$this->assertNotEmpty($metadata);
|
246 |
}
|
246 |
}
|
Línea 247... |
Línea 247... |
247 |
|
247 |
|
248 |
/**
|
248 |
/**
|
249 |
* Test that the reason for the null provider is returned.
|
249 |
* Test that the reason for the null provider is returned.
|
250 |
*
|
250 |
*
|
251 |
* @covers ::get_null_provider_reason
|
251 |
* @covers ::get_null_provider_reason
|
252 |
*/
|
252 |
*/
|
253 |
public function test_get_null_provider_reason() {
|
253 |
public function test_get_null_provider_reason(): void {
|
254 |
$manager = new \core_privacy\manager();
|
254 |
$manager = new \core_privacy\manager();
|
255 |
// Null providers return the reason string.
|
255 |
// Null providers return the reason string.
|
256 |
$this->assertEquals('testcomponent2 null provider reason', $manager->get_null_provider_reason('mod_testcomponent2'));
|
256 |
$this->assertEquals('testcomponent2 null provider reason', $manager->get_null_provider_reason('mod_testcomponent2'));
|
257 |
// Throw an exception if the wrong type of provider is given.
|
257 |
// Throw an exception if the wrong type of provider is given.
|
Línea 262... |
Línea 262... |
262 |
/**
|
262 |
/**
|
263 |
* Test that manager::plugintype_class_callback() can be executed.
|
263 |
* Test that manager::plugintype_class_callback() can be executed.
|
264 |
*
|
264 |
*
|
265 |
* @covers ::plugintype_class_callback
|
265 |
* @covers ::plugintype_class_callback
|
266 |
*/
|
266 |
*/
|
267 |
public function test_plugintype_class_callback() {
|
267 |
public function test_plugintype_class_callback(): void {
|
268 |
\core_privacy\manager::plugintype_class_callback('doesnotexist', 'unusable', 'foo', ['bar']);
|
268 |
\core_privacy\manager::plugintype_class_callback('doesnotexist', 'unusable', 'foo', ['bar']);
|
269 |
}
|
269 |
}
|
Línea 270... |
Línea 270... |
270 |
|
270 |
|
271 |
/**
|
271 |
/**
|
272 |
* Test that manager::component_class_callback() can be executed.
|
272 |
* Test that manager::component_class_callback() can be executed.
|
273 |
*
|
273 |
*
|
274 |
* @covers ::component_class_callback
|
274 |
* @covers ::component_class_callback
|
275 |
*/
|
275 |
*/
|
276 |
public function test_component_class_callback() {
|
276 |
public function test_component_class_callback(): void {
|
277 |
\core_privacy\manager::component_class_callback('foo_bar', 'unusable', 'foo', ['bar']);
|
277 |
\core_privacy\manager::component_class_callback('foo_bar', 'unusable', 'foo', ['bar']);
|
Línea 278... |
Línea 278... |
278 |
}
|
278 |
}
|
279 |
|
279 |
|
Línea 283... |
Línea 283... |
283 |
* @dataProvider is_empty_subsystem_provider
|
283 |
* @dataProvider is_empty_subsystem_provider
|
284 |
* @param string $component
|
284 |
* @param string $component
|
285 |
* @param bool $expected
|
285 |
* @param bool $expected
|
286 |
* @covers ::is_empty_subsystem
|
286 |
* @covers ::is_empty_subsystem
|
287 |
*/
|
287 |
*/
|
288 |
public function test_is_empty_subsystem($component, $expected) {
|
288 |
public function test_is_empty_subsystem($component, $expected): void {
|
289 |
$this->assertEquals($expected, \core_privacy\manager::is_empty_subsystem($component));
|
289 |
$this->assertEquals($expected, \core_privacy\manager::is_empty_subsystem($component));
|
290 |
}
|
290 |
}
|
Línea 291... |
Línea 291... |
291 |
|
291 |
|
292 |
/**
|
292 |
/**
|
Línea 322... |
Línea 322... |
322 |
/**
|
322 |
/**
|
323 |
* Test that get_contexts_for_userid() with a failing item.
|
323 |
* Test that get_contexts_for_userid() with a failing item.
|
324 |
*
|
324 |
*
|
325 |
* @covers ::get_contexts_for_userid
|
325 |
* @covers ::get_contexts_for_userid
|
326 |
*/
|
326 |
*/
|
327 |
public function test_get_contexts_for_userid_with_failing() {
|
327 |
public function test_get_contexts_for_userid_with_failing(): void {
|
328 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
328 |
// Get a mock manager, in which the core components list is mocked to include all mock plugins.
|
329 |
// testcomponent is a core provider, testcomponent2 isa null provider, testcomponent3 is subplugin provider (non core).
|
329 |
// testcomponent is a core provider, testcomponent2 isa null provider, testcomponent3 is subplugin provider (non core).
|
330 |
$mockman = $this->get_mock_manager_with_core_components(['mod_component_broken', 'mod_component_a']);
|
330 |
$mockman = $this->get_mock_manager_with_core_components(['mod_component_broken', 'mod_component_a']);
|
Línea 331... |
Línea 331... |
331 |
|
331 |
|
Línea 359... |
Línea 359... |
359 |
/**
|
359 |
/**
|
360 |
* Test that export_user_data() with a failing item.
|
360 |
* Test that export_user_data() with a failing item.
|
361 |
*
|
361 |
*
|
362 |
* @covers ::export_user_data
|
362 |
* @covers ::export_user_data
|
363 |
*/
|
363 |
*/
|
364 |
public function test_export_user_data_with_failing() {
|
364 |
public function test_export_user_data_with_failing(): void {
|
365 |
$user = \core_user::get_user_by_username('admin');
|
365 |
$user = \core_user::get_user_by_username('admin');
|
366 |
$mockman = $this->get_mock_manager_with_core_components(['mod_component_broken', 'mod_component_a']);
|
366 |
$mockman = $this->get_mock_manager_with_core_components(['mod_component_broken', 'mod_component_a']);
|
367 |
$context = \context_system::instance();
|
367 |
$context = \context_system::instance();
|
368 |
$contextid = $context->id;
|
368 |
$contextid = $context->id;
|
Línea 394... |
Línea 394... |
394 |
/**
|
394 |
/**
|
395 |
* Test that delete_data_for_user() with a failing item.
|
395 |
* Test that delete_data_for_user() with a failing item.
|
396 |
*
|
396 |
*
|
397 |
* @covers ::delete_data_for_user
|
397 |
* @covers ::delete_data_for_user
|
398 |
*/
|
398 |
*/
|
399 |
public function test_delete_data_for_user_with_failing() {
|
399 |
public function test_delete_data_for_user_with_failing(): void {
|
400 |
$user = \core_user::get_user_by_username('admin');
|
400 |
$user = \core_user::get_user_by_username('admin');
|
401 |
$mockman = $this->get_mock_manager_with_core_components(['mod_component_broken', 'mod_component_a']);
|
401 |
$mockman = $this->get_mock_manager_with_core_components(['mod_component_broken', 'mod_component_a']);
|
402 |
$context = \context_system::instance();
|
402 |
$context = \context_system::instance();
|
403 |
$contextid = $context->id;
|
403 |
$contextid = $context->id;
|
Línea 429... |
Línea 429... |
429 |
/**
|
429 |
/**
|
430 |
* Test that delete_data_for_all_users_in_context() with a failing item.
|
430 |
* Test that delete_data_for_all_users_in_context() with a failing item.
|
431 |
*
|
431 |
*
|
432 |
* @covers ::delete_data_for_all_users_in_context
|
432 |
* @covers ::delete_data_for_all_users_in_context
|
433 |
*/
|
433 |
*/
|
434 |
public function test_delete_data_for_all_users_in_context_with_failing() {
|
434 |
public function test_delete_data_for_all_users_in_context_with_failing(): void {
|
435 |
$user = \core_user::get_user_by_username('admin');
|
435 |
$user = \core_user::get_user_by_username('admin');
|
436 |
$mockman = $this->get_mock_manager_with_core_components(['mod_component_broken', 'mod_component_a']);
|
436 |
$mockman = $this->get_mock_manager_with_core_components(['mod_component_broken', 'mod_component_a']);
|
437 |
$context = \context_system::instance();
|
437 |
$context = \context_system::instance();
|
Línea 438... |
Línea 438... |
438 |
|
438 |
|
Línea 459... |
Línea 459... |
459 |
/**
|
459 |
/**
|
460 |
* Test that get_metadata_for_components() with a failing item.
|
460 |
* Test that get_metadata_for_components() with a failing item.
|
461 |
*
|
461 |
*
|
462 |
* @covers ::get_metadata_for_components
|
462 |
* @covers ::get_metadata_for_components
|
463 |
*/
|
463 |
*/
|
464 |
public function test_get_metadata_for_components_with_failing() {
|
464 |
public function test_get_metadata_for_components_with_failing(): void {
|
465 |
$user = \core_user::get_user_by_username('admin');
|
465 |
$user = \core_user::get_user_by_username('admin');
|
466 |
$mockman = $this->get_mock_manager_with_core_components(['mod_component_broken', 'mod_component_a']);
|
466 |
$mockman = $this->get_mock_manager_with_core_components(['mod_component_broken', 'mod_component_a']);
|
467 |
$context = \context_system::instance();
|
467 |
$context = \context_system::instance();
|
Línea 468... |
Línea 468... |
468 |
|
468 |
|