From 5a4d5b3331f5b46a2cfd55d8bee9a531544bfcf4 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 8 Nov 2018 15:28:58 +0800 Subject: [PATCH 1/1] MDL-63924 privacy: Add test to ensure shared_data_provider compliance --- privacy/tests/provider_test.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/privacy/tests/provider_test.php b/privacy/tests/provider_test.php index f59b042cd92..1576e91edf8 100644 --- a/privacy/tests/provider_test.php +++ b/privacy/tests/provider_test.php @@ -229,6 +229,31 @@ class provider_testcase extends advanced_testcase { }); } + /** + * Ensure that providers do not throw an error when processing a deleted user. + * + * @dataProvider is_shared_data_provider + * @param string $component + */ + public function test_shared_provider_implements_userlist($component) { + $classname = manager::get_provider_classname_for_component($component); + $this->assertTrue(is_subclass_of($classname, \core_privacy\local\request\userlist_provider::class)); + } + + /** + * List of providers which implement the core_user_data_provider. + * + * @return array + */ + public function is_shared_data_provider() { + return array_filter($this->get_component_list(), function($component) { + return static::component_implements( + $component['classname'], + \core_privacy\local\request\shared_data_provider::class + ); + }); + } + /** * Checks whether the component's provider class implements the specified interface, either directly or as a grandchild. * -- 2.17.0