mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
MDL-81521 core: Update all possibly data providers to be static
Note: Some data providers could not be automatically be converted to being static. These will be handled in a separate issue.
This commit is contained in:
parent
e1d05182a6
commit
c370c0cc5e
407 changed files with 1449 additions and 1430 deletions
|
@ -199,7 +199,7 @@ class collection_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function component_list_provider() {
|
||||
public static function component_list_provider(): array {
|
||||
return [
|
||||
['core_privacy'],
|
||||
['mod_forum'],
|
||||
|
|
|
@ -64,7 +64,7 @@ class contextlist_base_test extends advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_contextids_provider() {
|
||||
public static function get_contextids_provider(): array {
|
||||
return [
|
||||
'basic' => [
|
||||
[1, 2, 3, 4, 5],
|
||||
|
|
|
@ -137,7 +137,7 @@ class contextlist_test extends advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function data_guess_id_field_from_sql() {
|
||||
public static function data_guess_id_field_from_sql(): array {
|
||||
return [
|
||||
'easy' => [
|
||||
'SELECT contextid FROM {foo}',
|
||||
|
|
|
@ -139,7 +139,7 @@ class manager_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function component_is_compliant_provider() {
|
||||
public static function component_is_compliant_provider(): array {
|
||||
return [
|
||||
'An empty subsystem' => [
|
||||
'core_countries',
|
||||
|
@ -295,7 +295,7 @@ class manager_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function is_empty_subsystem_provider() {
|
||||
public static function is_empty_subsystem_provider(): array {
|
||||
return [
|
||||
'A subsystem which has no directory' => [
|
||||
'core_langconfig',
|
||||
|
|
|
@ -173,7 +173,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
|||
/**
|
||||
* Data provider for exporting user data.
|
||||
*/
|
||||
public function export_data_provider() {
|
||||
public static function export_data_provider(): array {
|
||||
return [
|
||||
'basic' => [
|
||||
(object) [
|
||||
|
@ -308,7 +308,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
|||
*
|
||||
* return array
|
||||
*/
|
||||
public function export_metadata_provider() {
|
||||
public static function export_metadata_provider(): array {
|
||||
return [
|
||||
'basic' => [
|
||||
'key',
|
||||
|
@ -472,7 +472,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function export_file_provider() {
|
||||
public static function export_file_provider(): array {
|
||||
return [
|
||||
'basic' => [
|
||||
'intro',
|
||||
|
@ -858,7 +858,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function export_user_preference_provider() {
|
||||
public static function export_user_preference_provider(): array {
|
||||
return [
|
||||
'basic' => [
|
||||
'core_privacy',
|
||||
|
@ -1024,7 +1024,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function unescaped_unicode_export_provider() {
|
||||
public static function unescaped_unicode_export_provider(): array {
|
||||
return [
|
||||
'Unicode' => ['ةكءيٓپچژکگیٹڈڑہھےâîûğŞAaÇÖáǽ你好!'],
|
||||
];
|
||||
|
@ -1193,7 +1193,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function long_filename_provider() {
|
||||
public static function long_filename_provider(): array {
|
||||
return [
|
||||
'More than 100 characters' => [
|
||||
'Etiam sit amet dui vel leo blandit viverra. Proin viverra suscipit velit. Aenean efficitur suscipit nibh nec suscipit',
|
||||
|
@ -1288,7 +1288,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rewrite_pluginfile_urls_provider() {
|
||||
public static function rewrite_pluginfile_urls_provider(): array {
|
||||
return [
|
||||
'nullcontent' => [
|
||||
'intro',
|
||||
|
|
|
@ -46,7 +46,7 @@ class provider_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array the array of frankenstyle component names with the relevant class name.
|
||||
*/
|
||||
public function get_component_list() {
|
||||
public static function get_component_list(): array {
|
||||
$components = ['core' => [
|
||||
'component' => 'core',
|
||||
'classname' => manager::get_provider_classname_for_component('core')
|
||||
|
@ -97,12 +97,12 @@ class provider_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function null_provider_provider() {
|
||||
return array_filter($this->get_component_list(), function($component) {
|
||||
return static::component_implements(
|
||||
$component['classname'],
|
||||
\core_privacy\local\metadata\null_provider::class
|
||||
);
|
||||
public static function null_provider_provider(): array {
|
||||
return array_filter(self::get_component_list(), function($component): bool {
|
||||
return static::component_implements(
|
||||
$component['classname'],
|
||||
\core_privacy\local\metadata\null_provider::class
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -218,12 +218,12 @@ class provider_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function metadata_provider_provider() {
|
||||
return array_filter($this->get_component_list(), function($component) {
|
||||
return static::component_implements(
|
||||
$component['classname'],
|
||||
\core_privacy\local\metadata\provider::class
|
||||
);
|
||||
public static function metadata_provider_provider(): array {
|
||||
return array_filter(self::get_component_list(), function($component): bool {
|
||||
return static::component_implements(
|
||||
$component['classname'],
|
||||
\core_privacy\local\metadata\provider::class
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -232,12 +232,12 @@ class provider_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function is_user_data_provider() {
|
||||
return array_filter($this->get_component_list(), function($component) {
|
||||
return static::component_implements(
|
||||
$component['classname'],
|
||||
\core_privacy\local\request\core_user_data_provider::class
|
||||
);
|
||||
public static function is_user_data_provider(): array {
|
||||
return array_filter(self::get_component_list(), function($component): bool {
|
||||
return static::component_implements(
|
||||
$component['classname'],
|
||||
\core_privacy\local\request\core_user_data_provider::class
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ class provider_test extends \advanced_testcase {
|
|||
}
|
||||
}
|
||||
|
||||
$componentlist = $this->metadata_provider_provider();
|
||||
$componentlist = self::metadata_provider_provider();
|
||||
foreach ($componentlist as $componentarray) {
|
||||
$component = $componentarray['component'];
|
||||
$classname = $componentarray['classname'];
|
||||
|
|
|
@ -110,7 +110,7 @@ class request_transform_test extends advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function yesno_provider() {
|
||||
public static function yesno_provider(): array {
|
||||
return [
|
||||
'Bool False' => [
|
||||
false,
|
||||
|
|
|
@ -84,7 +84,7 @@ class types_database_table_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function invalid_string_provider() {
|
||||
public static function invalid_string_provider(): array {
|
||||
return [
|
||||
'Space in summary' => [
|
||||
'example',
|
||||
|
@ -128,7 +128,7 @@ class types_database_table_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function valid_string_provider() {
|
||||
public static function valid_string_provider(): array {
|
||||
return [
|
||||
'Valid combination' => [
|
||||
'example',
|
||||
|
|
|
@ -84,7 +84,7 @@ class types_external_location_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function invalid_string_provider() {
|
||||
public static function invalid_string_provider(): array {
|
||||
return [
|
||||
'Space in summary' => [
|
||||
'example',
|
||||
|
@ -128,7 +128,7 @@ class types_external_location_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function valid_string_provider() {
|
||||
public static function valid_string_provider(): array {
|
||||
return [
|
||||
'Valid combination' => [
|
||||
'example',
|
||||
|
|
|
@ -77,7 +77,7 @@ class types_plugintype_link_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function invalid_string_provider() {
|
||||
public static function invalid_string_provider(): array {
|
||||
return [
|
||||
'Space in summary' => [
|
||||
'example',
|
||||
|
@ -97,7 +97,7 @@ class types_plugintype_link_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function valid_string_provider() {
|
||||
public static function valid_string_provider(): array {
|
||||
return [
|
||||
'Valid combination' => [
|
||||
'example',
|
||||
|
|
|
@ -77,7 +77,7 @@ class types_subsystem_link_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function invalid_string_provider() {
|
||||
public static function invalid_string_provider(): array {
|
||||
return [
|
||||
'Space in summary' => [
|
||||
'example',
|
||||
|
@ -97,7 +97,7 @@ class types_subsystem_link_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function valid_string_provider() {
|
||||
public static function valid_string_provider(): array {
|
||||
return [
|
||||
'Valid combination' => [
|
||||
'example',
|
||||
|
|
|
@ -77,7 +77,7 @@ class types_user_preference_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function invalid_string_provider() {
|
||||
public static function invalid_string_provider(): array {
|
||||
return [
|
||||
'Space in summary' => [
|
||||
'example',
|
||||
|
@ -95,7 +95,7 @@ class types_user_preference_test extends \advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function valid_string_provider() {
|
||||
public static function valid_string_provider(): array {
|
||||
return [
|
||||
'Valid combination' => [
|
||||
'example',
|
||||
|
|
|
@ -64,7 +64,7 @@ class userlist_base_test extends advanced_testcase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_userids_provider() {
|
||||
public static function get_userids_provider(): array {
|
||||
return [
|
||||
'basic' => [
|
||||
[1, 2, 3, 4, 5],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue