diff --git a/.gitignore b/.gitignore index be141300074..452150d63ac 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ moodle-plugin-ci.phar phpcs.xml jsconfig.json UPGRADING-CURRENT.md +.phpunit.cache diff --git a/admin/presets/tests/local/setting/adminpresets_admin_setting_bloglevel_test.php b/admin/presets/tests/local/setting/adminpresets_admin_setting_bloglevel_test.php index a040691bb44..f2aea66d24c 100644 --- a/admin/presets/tests/local/setting/adminpresets_admin_setting_bloglevel_test.php +++ b/admin/presets/tests/local/setting/adminpresets_admin_setting_bloglevel_test.php @@ -75,15 +75,15 @@ final class adminpresets_admin_setting_bloglevel_test extends \advanced_testcase public static function save_value_provider(): array { return [ 'Save the bloglevel and set blog_menu block visibility to true' => [ - 'setttingvalue' => BLOG_USER_LEVEL, + 'settingvalue' => BLOG_USER_LEVEL, 'expectedsaved' => true, ], 'Same value to bloglevel, so it will not be saved' => [ - 'setttingvalue' => BLOG_SITE_LEVEL, + 'settingvalue' => BLOG_SITE_LEVEL, 'expectedsaved' => false, ], 'Save the bloglevel and set blog_menu block visibility to false' => [ - 'setttingvalue' => 0, + 'settingvalue' => 0, 'expectedsaved' => true, ], ]; diff --git a/admin/presets/tests/local/setting/adminpresets_admin_setting_sitesettext_test.php b/admin/presets/tests/local/setting/adminpresets_admin_setting_sitesettext_test.php index ba0c9f8b460..0fa19435d83 100644 --- a/admin/presets/tests/local/setting/adminpresets_admin_setting_sitesettext_test.php +++ b/admin/presets/tests/local/setting/adminpresets_admin_setting_sitesettext_test.php @@ -70,22 +70,22 @@ final class adminpresets_admin_setting_sitesettext_test extends \advanced_testca return [ 'Fullname: different value' => [ 'settingname' => 'fullname', - 'setttingvalue' => 'New site fullname', + 'settingvalue' => 'New site fullname', 'expectedsaved' => true, ], 'Fullname: same value' => [ 'settingname' => 'fullname', - 'setttingvalue' => 'PHPUnit test site', + 'settingvalue' => 'PHPUnit test site', 'expectedsaved' => false, ], 'Summary: different value' => [ 'settingname' => 'summary', - 'setttingvalue' => 'This is a new site summary.', + 'settingvalue' => 'This is a new site summary.', 'expectedsaved' => true, ], 'Summary: same value' => [ 'settingname' => 'summary', - 'setttingvalue' => '', + 'settingvalue' => '', 'expectedsaved' => false, ], ]; diff --git a/admin/presets/tests/local/setting/adminpresets_setting_test.php b/admin/presets/tests/local/setting/adminpresets_setting_test.php index b44e7f4f3e0..f140dd53531 100644 --- a/admin/presets/tests/local/setting/adminpresets_setting_test.php +++ b/admin/presets/tests/local/setting/adminpresets_setting_test.php @@ -83,28 +83,28 @@ final class adminpresets_setting_test extends \advanced_testcase { 'category' => 'optionalsubsystems', 'settingplugin' => 'core', 'settingname' => 'enablebadges', - 'setttingvalue' => '1', + 'settingvalue' => '1', 'expectedsaved' => false, ], 'Core setting with a different value is saved' => [ 'category' => 'optionalsubsystems', 'settingplugin' => 'core', 'settingname' => 'enablebadges', - 'setttingvalue' => '0', + 'settingvalue' => '0', 'expectedsaved' => true, ], 'Plugin setting with the same value is not saved' => [ 'category' => 'modsettinglesson', 'settingplugin' => 'mod_lesson', 'settingname' => 'mediawidth', - 'setttingvalue' => '640', + 'settingvalue' => '640', 'expectedsaved' => false, ], 'Plugin setting with different value is saved' => [ 'category' => 'modsettinglesson', 'settingplugin' => 'mod_lesson', 'settingname' => 'mediawidth', - 'setttingvalue' => '900', + 'settingvalue' => '900', 'expectedsaved' => true, ], ]; @@ -174,7 +174,7 @@ final class adminpresets_setting_test extends \advanced_testcase { 'settingplugin' => 'mod_lesson', 'settingname' => 'maxanswers', 'advsettingname' => 'maxanswers_adv', - 'advsetttingvalue' => '1', + 'advsettingvalue' => '1', 'expectedsaved' => false, ], 'Plugin setting with different value is saved' => [ @@ -182,7 +182,7 @@ final class adminpresets_setting_test extends \advanced_testcase { 'settingplugin' => 'mod_lesson', 'settingname' => 'maxanswers', 'advsettingname' => 'maxanswers_adv', - 'advsetttingvalue' => '0', + 'advsettingvalue' => '0', 'expectedsaved' => true, ], 'Plugin setting without advanced attributes are not saved' => [ @@ -190,7 +190,7 @@ final class adminpresets_setting_test extends \advanced_testcase { 'settingplugin' => 'mod_lesson', 'settingname' => 'maxanswers', 'advsettingname' => null, - 'advsetttingvalue' => '0', + 'advsettingvalue' => '0', 'expectedsaved' => false, ], ]; diff --git a/admin/tests/external/set_plugin_order_test.php b/admin/tests/external/set_plugin_order_test.php index e43414eafc6..e0cba9901b9 100644 --- a/admin/tests/external/set_plugin_order_test.php +++ b/admin/tests/external/set_plugin_order_test.php @@ -86,45 +86,45 @@ final class set_plugin_order_test extends \externallib_advanced_testcase { return [ [ 'initialstate' => 'textarea,tiny', - 'pluginname' => 'editor_textarea', + 'plugin' => 'editor_textarea', 'direction' => 1, // DOWN. - 'expected' => $getorder([ + 'neworder' => $getorder([ 'tiny', 'textarea', ]), - 'newtexteditors' => 'tiny,textarea', + 'newstate' => 'tiny,textarea', ], [ 'initialstate' => 'textarea,tiny', - 'pluginname' => 'editor_textarea', + 'plugin' => 'editor_textarea', 'direction' => -1, // UP. - 'expected' => $getorder([ + 'neworder' => $getorder([ 'textarea', 'tiny', ]), - 'newtexteditors' => 'textarea,tiny', + 'newstate' => 'textarea,tiny', ], [ 'initialstate' => 'textarea,tiny', - 'pluginname' => 'editor_tiny', + 'plugin' => 'editor_tiny', 'direction' => 1, // DOWN. // Tiny is already at the bottom of the list of enabled plugins. - 'expected' => $getorder([ + 'neworder' => $getorder([ 'textarea', 'tiny', ]), - 'newtexteditors' => 'textarea,tiny', + 'newstate' => 'textarea,tiny', ], [ 'initialstate' => 'textarea,tiny', - 'pluginname' => 'editor_atto', + 'plugin' => 'editor_atto', 'direction' => 1, // DOWN. // Atto is not enabled. Disabled editors are listed lexically after enabled editors. - 'expected' => $getorder([ + 'neworder' => $getorder([ 'textarea', 'tiny', ]), - 'newtexteditors' => 'textarea,tiny', + 'newstate' => 'textarea,tiny', ], ]; } diff --git a/admin/tool/behat/tests/manager_util_test.php b/admin/tool/behat/tests/manager_util_test.php index 0025a55efd0..b2ec37f7edf 100644 --- a/admin/tool/behat/tests/manager_util_test.php +++ b/admin/tool/behat/tests/manager_util_test.php @@ -468,7 +468,7 @@ final class manager_util_test extends \advanced_testcase { $CFG->dirroot = $oldroot; } - public function clean_features_path_list() { + public static function clean_features_path_list() { return array( ['/home/test/this/that/test/behat/mod_assign.feature', 'mod_assign_behat_test_that_this_test', '/home/test/this/that/test/behat/mod_assign.feature'], ['/home/this/that/test/behat/mod_assign.feature', 'mod_assign_behat_test_that_this_home', '/home/this/that/test/behat/mod_assign.feature'], diff --git a/admin/tool/dataprivacy/tests/data_request_test.php b/admin/tool/dataprivacy/tests/data_request_test.php index e8657ab9541..a71f3c3eb6a 100644 --- a/admin/tool/dataprivacy/tests/data_request_test.php +++ b/admin/tool/dataprivacy/tests/data_request_test.php @@ -89,13 +89,13 @@ final class data_request_test extends data_privacy_testcase { * Test the pseudo states of a data request with an export request. * * @dataProvider status_state_provider - * @param int $status + * @param int $state * @param bool $resettable * @param bool $active */ - public function test_pseudo_states_export(int $status, bool $resettable, bool $active): void { + public function test_pseudo_states_export(int $state, bool $resettable, bool $active): void { $uut = new \tool_dataprivacy\data_request(); - $uut->set('status', $status); + $uut->set('status', $state); $uut->set('type', api::DATAREQUEST_TYPE_EXPORT); $this->assertEquals($resettable, $uut->is_resettable()); @@ -106,13 +106,13 @@ final class data_request_test extends data_privacy_testcase { * Test the pseudo states of a data request with a delete request. * * @dataProvider status_state_provider - * @param int $status + * @param int $state * @param bool $resettable * @param bool $active */ - public function test_pseudo_states_delete(int $status, bool $resettable, bool $active): void { + public function test_pseudo_states_delete(int $state, bool $resettable, bool $active): void { $uut = new \tool_dataprivacy\data_request(); - $uut->set('status', $status); + $uut->set('status', $state); $uut->set('type', api::DATAREQUEST_TYPE_DELETE); $this->assertEquals($resettable, $uut->is_resettable()); @@ -123,11 +123,11 @@ final class data_request_test extends data_privacy_testcase { * Test the pseudo states of a data request. * * @dataProvider status_state_provider - * @param int $status + * @param int $state */ - public function test_can_reset_others($status): void { + public function test_can_reset_others(int $state, bool $resettable, bool $active): void { $uut = new \tool_dataprivacy\data_request(); - $uut->set('status', $status); + $uut->set('status', $state); $uut->set('type', api::DATAREQUEST_TYPE_OTHERS); $this->assertFalse($uut->is_resettable()); @@ -142,7 +142,7 @@ final class data_request_test extends data_privacy_testcase { $states = []; foreach (self::status_state_provider() as $thisstatus) { if (!$thisstatus['resettable']) { - $states[] = $thisstatus; + $states[] = ['state' => $thisstatus['state']]; } } @@ -153,11 +153,11 @@ final class data_request_test extends data_privacy_testcase { * Ensure that requests which are not resettable cause an exception to be thrown. * * @dataProvider non_resettable_provider - * @param int $status + * @param int $state */ - public function test_non_resubmit_request($status): void { + public function test_non_resubmit_request($state): void { $uut = new \tool_dataprivacy\data_request(); - $uut->set('status', $status); + $uut->set('status', $state); $this->expectException(\moodle_exception::class); $this->expectExceptionMessage(get_string('cannotreset', 'tool_dataprivacy')); diff --git a/admin/tool/dataprivacy/tests/filtered_userlist_test.php b/admin/tool/dataprivacy/tests/filtered_userlist_test.php index eb73fae9d24..0269ea3dd91 100644 --- a/admin/tool/dataprivacy/tests/filtered_userlist_test.php +++ b/admin/tool/dataprivacy/tests/filtered_userlist_test.php @@ -61,28 +61,28 @@ final class filtered_userlist_test extends \advanced_testcase { return [ // Entire list should be preserved. 'No overrides' => [ - 'users' => [1, 2, 3, 4, 5], + 'initial' => [1, 2, 3, 4, 5], 'expired' => [], 'unexpired' => [], - [1, 2, 3, 4, 5], + 'expected' => [1, 2, 3, 4, 5], ], // The list should be filtered to only keep the expired users. 'Expired only' => [ - 'users' => [1, 2, 3, 4, 5], + 'initial' => [1, 2, 3, 4, 5], 'expired' => [2, 3, 4], 'unexpired' => [], 'expected' => [2, 3, 4], ], // The list should be filtered to remove any unexpired users. 'Unexpired only' => [ - 'users' => [1, 2, 3, 4, 5], + 'initial' => [1, 2, 3, 4, 5], 'expired' => [], 'unexpired' => [1, 5], 'expected' => [2, 3, 4], ], // The list should be filtered to only keep expired users who are not on the unexpired list. 'Combination of expired and unexpired' => [ - 'users' => [1, 2, 3, 4, 5], + 'initial' => [1, 2, 3, 4, 5], 'expired' => [1, 2, 3], 'unexpired' => [1, 5], 'expected' => [2, 3], diff --git a/admin/tool/httpsreplace/tests/httpsreplace_test.php b/admin/tool/httpsreplace/tests/httpsreplace_test.php index 5621fdb6da6..9315bf9dfa7 100644 --- a/admin/tool/httpsreplace/tests/httpsreplace_test.php +++ b/admin/tool/httpsreplace/tests/httpsreplace_test.php @@ -134,15 +134,15 @@ final class httpsreplace_test extends \advanced_testcase { /** * Test upgrade_http_links * @param string $content Example content that we'll attempt to replace. - * @param string $ouputregex Regex for what output we expect. + * @param string $outputregex Regex for what output we expect. * @param string $expectedcontent What content we are expecting afterwards. * @dataProvider upgrade_http_links_provider */ - public function test_upgrade_http_links($content, $ouputregex, $expectedcontent): void { + public function test_upgrade_http_links($content, $outputregex, $expectedcontent): void { global $DB; $this->resetAfterTest(); - $this->expectOutputRegex($ouputregex); + $this->expectOutputRegex($outputregex); $finder = new tool_httpreplace_url_finder_mock(); diff --git a/admin/tool/moodlenet/tests/local/url_test.php b/admin/tool/moodlenet/tests/local/url_test.php index f9d74cd1f35..9422b24e6c7 100644 --- a/admin/tool/moodlenet/tests/local/url_test.php +++ b/admin/tool/moodlenet/tests/local/url_test.php @@ -32,7 +32,7 @@ final class url_test extends \advanced_testcase { * Test the parsing to host + path components. * * @dataProvider url_provider - * @param string $urlstring The full URL string + * @param string $url The full URL string * @param string $host the expected host component of the URL. * @param string $path the expected path component of the URL. * @param bool $exception whether or not an exception is expected during construction. @@ -58,37 +58,37 @@ final class url_test extends \advanced_testcase { public static function url_provider(): array { return [ 'No path' => [ - 'url' => 'https://example.moodle.net', + 'urlstring' => 'https://example.moodle.net', 'host' => 'example.moodle.net', 'path' => null, 'exception' => false, ], 'Slash path' => [ - 'url' => 'https://example.moodle.net/', + 'urlstring' => 'https://example.moodle.net/', 'host' => 'example.moodle.net', 'path' => '/', 'exception' => false, ], 'Path includes file and extension' => [ - 'url' => 'https://example.moodle.net/uploads/123456789/pic.png', + 'urlstring' => 'https://example.moodle.net/uploads/123456789/pic.png', 'host' => 'example.moodle.net', 'path' => '/uploads/123456789/pic.png', 'exception' => false, ], 'Path includes file, extension and params' => [ - 'url' => 'https://example.moodle.net/uploads/123456789/pic.png?option=1&option2=test', + 'urlstring' => 'https://example.moodle.net/uploads/123456789/pic.png?option=1&option2=test', 'host' => 'example.moodle.net', 'path' => '/uploads/123456789/pic.png', 'exception' => false, ], 'Malformed - invalid' => [ - 'url' => 'invalid', + 'urlstring' => 'invalid', 'host' => null, 'path' => null, 'exception' => true, ], 'Direct, non-encoded utf8 - invalid' => [ - 'url' => 'http://москва.рф/services/', + 'urlstring' => 'http://москва.рф/services/', 'host' => 'москва.рф', 'path' => '/services/', 'exception' => true, diff --git a/admin/tool/policy/tests/privacy/provider_test.php b/admin/tool/policy/tests/privacy/provider_test.php index ccbe43588d6..e3ce8275336 100644 --- a/admin/tool/policy/tests/privacy/provider_test.php +++ b/admin/tool/policy/tests/privacy/provider_test.php @@ -24,14 +24,11 @@ */ namespace tool_policy\privacy; -use core_privacy\local\metadata\collection; -use tool_policy\privacy\provider; -use tool_policy\api; -use tool_policy\policy_version; use core_privacy\local\request\approved_contextlist; use core_privacy\local\request\writer; - -defined('MOODLE_INTERNAL') || die(); +use tool_policy\api; +use tool_policy\policy_version; +use tool_policy\privacy\provider; /** * Privacy provider tests class. @@ -76,9 +73,9 @@ final class provider_test extends \core_privacy\tests\provider_testcase { global $CFG; // When there are no policies or agreements context list is empty. - $contextlist = \tool_policy\privacy\provider::get_contexts_for_userid($this->manager->id); + $contextlist = provider::get_contexts_for_userid($this->manager->id); $this->assertEmpty($contextlist); - $contextlist = \tool_policy\privacy\provider::get_contexts_for_userid($this->user->id); + $contextlist = provider::get_contexts_for_userid($this->user->id); $this->assertEmpty($contextlist); // Create a policy. @@ -88,11 +85,11 @@ final class provider_test extends \core_privacy\tests\provider_testcase { api::make_current($policy->get('id')); // After creating a policy, there should be manager context. - $contextlist = \tool_policy\privacy\provider::get_contexts_for_userid($this->manager->id); + $contextlist = provider::get_contexts_for_userid($this->manager->id); $this->assertEquals(1, $contextlist->count()); // But when there are no agreements, user context list is empty. - $contextlist = \tool_policy\privacy\provider::get_contexts_for_userid($this->user->id); + $contextlist = provider::get_contexts_for_userid($this->user->id); $this->assertEmpty($contextlist); // Agree to the policy. @@ -100,7 +97,7 @@ final class provider_test extends \core_privacy\tests\provider_testcase { api::accept_policies([$policy->get('id')]); // There should be user context. - $contextlist = \tool_policy\privacy\provider::get_contexts_for_userid($this->user->id); + $contextlist = provider::get_contexts_for_userid($this->user->id); $this->assertEquals(1, $contextlist->count()); } @@ -278,7 +275,7 @@ final class provider_test extends \core_privacy\tests\provider_testcase { $this->assertCount(3, $contextlist); $this->assertEqualsCanonicalizing( [$managercontext->id, $usercontext->id, $systemcontext->id], - $contextlist->get_contextids() + array_values($contextlist->get_contextids()), ); $approvedcontextlist = new approved_contextlist($this->user, 'tool_policy', [$usercontext->id]); diff --git a/analytics/tests/prediction_test.php b/analytics/tests/prediction_test.php index ff80e303cbd..04f1ee38431 100644 --- a/analytics/tests/prediction_test.php +++ b/analytics/tests/prediction_test.php @@ -783,7 +783,7 @@ final class prediction_test extends \advanced_testcase { 'bad' => array( 'modelquality' => 'random', 'ncourses' => 50, - 'expectedresults' => array( + 'expected' => array( '\core\analytics\time_splitting\single_range' => \core_analytics\model::LOW_SCORE, '\core\analytics\time_splitting\quarters' => \core_analytics\model::LOW_SCORE, ) @@ -791,7 +791,7 @@ final class prediction_test extends \advanced_testcase { 'good' => array( 'modelquality' => 'perfect', 'ncourses' => 50, - 'expectedresults' => array( + 'expected' => array( '\core\analytics\time_splitting\single_range' => \core_analytics\model::OK, '\core\analytics\time_splitting\quarters' => \core_analytics\model::OK, ) @@ -969,7 +969,7 @@ final class prediction_test extends \advanced_testcase { foreach ($cases as $key => $case) { if (!$predictionsprocessor instanceof \mlbackend_python\processor || empty($testpythonserver)) { - $extraparams = ['predictionsprocessor' => $classfullname, 'forcedconfig' => null]; + $extraparams = ['predictionsprocessorclass' => $classfullname, 'forcedconfig' => null]; $return[$key . '-' . $classfullname] = $case + $extraparams; } else { @@ -979,7 +979,7 @@ final class prediction_test extends \advanced_testcase { 'port' => TEST_MLBACKEND_PYTHON_PORT, 'secure' => false, 'username' => TEST_MLBACKEND_PYTHON_USERNAME, 'password' => TEST_MLBACKEND_PYTHON_PASSWORD]]; $casekey = $key . '-' . $classfullname . '-server'; - $return[$casekey] = $case + ['predictionsprocessor' => $classfullname, 'forcedconfig' => $forcedconfig]; + $return[$casekey] = $case + ['predictionsprocessorclass' => $classfullname, 'forcedconfig' => $forcedconfig]; } } } diff --git a/auth/lti/tests/auth_test.php b/auth/lti/tests/auth_test.php index 8a6b6f80fa8..edae502f02c 100644 --- a/auth/lti/tests/auth_test.php +++ b/auth/lti/tests/auth_test.php @@ -211,7 +211,7 @@ final class auth_test extends \advanced_testcase { /** * Test which verifies a user account can be created/found using the find_or_create_user_from_launch() method. * - * @dataProvider launch_data_provider + * @dataProvider launchdata_provider * @param array|null $legacydata legacy user and tool data, if testing migration cases. * @param array $launchdata data describing the launch, including user data and migration claim data. * @param array $expected the test case expectations. @@ -289,11 +289,11 @@ final class auth_test extends \advanced_testcase { * * @return array the test case data. */ - public static function launch_data_provider(): array { + public static function launchdata_provider(): array { return [ 'New (unlinked) platform learner including PII, no legacy user, no migration claim' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -302,8 +302,8 @@ final class auth_test extends \advanced_testcase { ], ], 'New (unlinked) platform learner excluding names, no legacy user, no migration claim' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -313,8 +313,8 @@ final class auth_test extends \advanced_testcase { ], ], 'New (unlinked) platform learner excluding emails, no legacy user, no migration claim' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -325,8 +325,8 @@ final class auth_test extends \advanced_testcase { ], ], 'New (unlinked) platform learner excluding all PII, no legacy user, no migration claim' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -337,7 +337,7 @@ final class auth_test extends \advanced_testcase { ], ], 'New (unlinked) platform learner including PII, existing legacy user, valid migration claim' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], @@ -347,7 +347,7 @@ final class auth_test extends \advanced_testcase { ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -366,7 +366,7 @@ final class auth_test extends \advanced_testcase { ] ], 'New (unlinked) platform learner including PII, existing legacy user, no migration claim' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], @@ -376,7 +376,7 @@ final class auth_test extends \advanced_testcase { ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -388,7 +388,7 @@ final class auth_test extends \advanced_testcase { ] ], 'New (unlinked) platform learner including PII, existing legacy user, migration missing consumer_key' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], @@ -398,7 +398,7 @@ final class auth_test extends \advanced_testcase { ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -417,7 +417,7 @@ final class auth_test extends \advanced_testcase { ] ], 'New (unlinked) platform learner including PII, existing legacy user, migration bad consumer_key' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], @@ -427,7 +427,7 @@ final class auth_test extends \advanced_testcase { ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -446,7 +446,7 @@ final class auth_test extends \advanced_testcase { ] ], 'New (unlinked) platform learner including PII, existing legacy user, migration user not matched' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], @@ -456,7 +456,7 @@ final class auth_test extends \advanced_testcase { ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -475,7 +475,7 @@ final class auth_test extends \advanced_testcase { ] ], 'New (unlinked) platform learner including PII, existing legacy user, valid migration claim secret2' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], @@ -485,7 +485,7 @@ final class auth_test extends \advanced_testcase { ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -504,7 +504,7 @@ final class auth_test extends \advanced_testcase { ] ], 'New (unlinked) platform learner including PII, existing legacy user, migration claim bad secret' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], @@ -514,7 +514,7 @@ final class auth_test extends \advanced_testcase { ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -534,7 +534,7 @@ final class auth_test extends \advanced_testcase { ] ], 'New (unlinked) platform learner including PII, no legacy user, valid migration claim' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [], 'consumer_key' => 'CONSUMER_1', 'tools' => [ @@ -542,7 +542,7 @@ final class auth_test extends \advanced_testcase { ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -561,7 +561,7 @@ final class auth_test extends \advanced_testcase { ] ], 'New (unlinked) platform learner excluding PII, existing legacy user, valid migration claim' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], @@ -571,7 +571,7 @@ final class auth_test extends \advanced_testcase { ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -592,8 +592,8 @@ final class auth_test extends \advanced_testcase { ] ], 'New (unlinked) platform instructor including PII, no legacy user, no migration claim' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor' @@ -602,8 +602,8 @@ final class auth_test extends \advanced_testcase { ], ], 'New (unlinked) platform instructor excluding PII, no legacy user, no migration claim' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor', @@ -614,7 +614,7 @@ final class auth_test extends \advanced_testcase { ], ], 'New (unlinked) platform instructor including PII, existing legacy user, valid migration claim' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], @@ -624,7 +624,7 @@ final class auth_test extends \advanced_testcase { ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor' @@ -643,8 +643,8 @@ final class auth_test extends \advanced_testcase { ] ], 'Existing (linked) platform learner including PII, no legacy user, no migration claim' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'has_authenticated_before' => true, 'user' => self::get_mock_users_with_ids( ['1'], @@ -654,8 +654,8 @@ final class auth_test extends \advanced_testcase { ], ], 'Existing (linked) platform learner excluding PII, no legacy user, no migration claim' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'has_authenticated_before' => true, 'user' => self::get_mock_users_with_ids( ['1'], @@ -667,8 +667,8 @@ final class auth_test extends \advanced_testcase { ], ], 'Existing (linked) platform instructor including PII, no legacy user, no migration claim' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'has_authenticated_before' => true, 'user' => self::get_mock_users_with_ids( ['1'], @@ -678,8 +678,8 @@ final class auth_test extends \advanced_testcase { ], ], 'Existing (linked) platform instructor excluding PII, no legacy user, no migration claim' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'has_authenticated_before' => true, 'user' => self::get_mock_users_with_ids( ['1'], @@ -691,8 +691,8 @@ final class auth_test extends \advanced_testcase { ], ], 'New (unlinked) platform instructor excluding PII, picture included' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'has_authenticated_before' => false, 'user' => self::get_mock_users_with_ids( ['1'], @@ -816,23 +816,23 @@ final class auth_test extends \advanced_testcase { public static function membership_data_provider(): array { return [ 'New (unlinked) platform learner including PII, no legacy data, no consumer key bound, no legacy id' => [ - 'legacy_data' => null, - 'membership_data' => [ + 'legacydata' => null, + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' )[0], ], 'iss' => self::$issuer, - 'legacy_consumer_key' => null, + 'legacyconsumerkey' => null, 'expected' => [ 'PII' => self::PII_ALL, 'migrated' => false ] ], 'New (unlinked) platform learner excluding PII, no legacy data, no consumer key bound, no legacy id' => [ - 'legacy_data' => null, - 'membership_data' => [ + 'legacydata' => null, + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -841,15 +841,15 @@ final class auth_test extends \advanced_testcase { )[0], ], 'iss' => self::$issuer, - 'legacy_consumer_key' => null, + 'legacyconsumerkey' => null, 'expected' => [ 'PII' => self::PII_NONE, 'migrated' => false ] ], 'New (unlinked) platform learner excluding names, no legacy data, no consumer key bound, no legacy id' => [ - 'legacy_data' => null, - 'membership_data' => [ + 'legacydata' => null, + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -857,15 +857,15 @@ final class auth_test extends \advanced_testcase { )[0], ], 'iss' => self::$issuer, - 'legacy_consumer_key' => null, + 'legacyconsumerkey' => null, 'expected' => [ 'PII' => self::PII_EMAILS_ONLY, 'migrated' => false ] ], 'New (unlinked) platform learner excluding email, no legacy data, no consumer key bound, no legacy id' => [ - 'legacy_data' => null, - 'membership_data' => [ + 'legacydata' => null, + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -874,20 +874,20 @@ final class auth_test extends \advanced_testcase { )[0], ], 'iss' => self::$issuer, - 'legacy_consumer_key' => null, + 'legacyconsumerkey' => null, 'expected' => [ 'PII' => self::PII_NAMES_ONLY, 'migrated' => false ] ], 'New (unlinked) platform learner including PII, legacy user, consumer key bound, legacy user id sent' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], 'consumer_key' => 'CONSUMER_1', ], - 'membership_data' => [ + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -895,80 +895,80 @@ final class auth_test extends \advanced_testcase { 'legacy_user_id' => '123-abc' ], 'iss' => self::$issuer, - 'legacy_consumer_key' => 'CONSUMER_1', + 'legacyconsumerkey' => 'CONSUMER_1', 'expected' => [ 'PII' => self::PII_ALL, 'migrated' => true ] ], 'New (unlinked) platform learner including PII, legacy user, consumer key bound, legacy user id omitted' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], 'consumer_key' => 'CONSUMER_1', ], - 'membership_data' => [ + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' )[0], ], 'iss' => self::$issuer, - 'legacy_consumer_key' => 'CONSUMER_1', + 'legacyconsumerkey' => 'CONSUMER_1', 'expected' => [ 'PII' => self::PII_ALL, 'migrated' => false, ] ], 'New (unlinked) platform learner including PII, legacy user, consumer key bound, no change in user id' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], 'consumer_key' => 'CONSUMER_1', ], - 'membership_data' => [ + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['123-abc'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' )[0], ], 'iss' => self::$issuer, - 'legacy_consumer_key' => 'CONSUMER_1', + 'legacyconsumerkey' => 'CONSUMER_1', 'expected' => [ 'PII' => self::PII_ALL, 'migrated' => true ] ], 'New (unlinked) platform learner including PII, legacy user, unexpected consumer key bound, no change in user id' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], 'consumer_key' => 'CONSUMER_1', ], - 'membership_data' => [ + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['123-abc'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' )[0], ], 'iss' => self::$issuer, - 'legacy_consumer_key' => 'CONSUMER_ABCDEF', + 'legacyconsumerkey' => 'CONSUMER_ABCDEF', 'expected' => [ 'PII' => self::PII_ALL, 'migrated' => false, ] ], 'New (unlinked) platform learner including PII, legacy user, consumer key not bound, legacy user id sent' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '123-abc'], ], 'consumer_key' => 'CONSUMER_1', ], - 'membership_data' => [ + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -976,15 +976,15 @@ final class auth_test extends \advanced_testcase { 'legacy_user_id' => '123-abc' ], 'iss' => self::$issuer, - 'legacy_consumer_key' => null, + 'legacyconsumerkey' => null, 'expected' => [ 'PII' => self::PII_ALL, 'migrated' => false ] ], 'New (unlinked) platform learner including PII, no legacy data, consumer key bound, legacy user id sent' => [ - 'legacy_data' => null, - 'membership_data' => [ + 'legacydata' => null, + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -992,30 +992,30 @@ final class auth_test extends \advanced_testcase { 'legacy_user_id' => '123-abc' ], 'iss' => self::$issuer, - 'legacy_consumer_key' => 'CONSUMER_1', + 'legacyconsumerkey' => 'CONSUMER_1', 'expected' => [ 'PII' => self::PII_ALL, 'migrated' => false ] ], 'New (unlinked) platform instructor including PII, no legacy data, no consumer key bound, no legacy id' => [ - 'legacy_data' => null, - 'membership_data' => [ + 'legacydata' => null, + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor' )[0], ], 'iss' => self::$issuer, - 'legacy_consumer_key' => null, + 'legacyconsumerkey' => null, 'expected' => [ 'PII' => self::PII_ALL, 'migrated' => false ] ], 'New (unlinked) platform instructor excluding PII, no legacy data, no consumer key bound, no legacy id' => [ - 'legacy_data' => null, - 'membership_data' => [ + 'legacydata' => null, + 'memberdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor', @@ -1024,15 +1024,15 @@ final class auth_test extends \advanced_testcase { )[0], ], 'iss' => self::$issuer, - 'legacy_consumer_key' => null, + 'legacyconsumerkey' => null, 'expected' => [ 'PII' => self::PII_NONE, 'migrated' => false ] ], 'Existing (linked) platform learner including PII, no legacy data, no consumer key bound, no legacy id' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'memberdata' => [ 'has_authenticated_before' => true, 'user' => self::get_mock_users_with_ids( ['1'], @@ -1040,7 +1040,7 @@ final class auth_test extends \advanced_testcase { )[0], ], 'iss' => self::$issuer, - 'legacy_consumer_key' => null, + 'legacyconsumerkey' => null, 'expected' => [ 'PII' => self::PII_ALL, 'migrated' => false @@ -1154,13 +1154,13 @@ final class auth_test extends \advanced_testcase { public static function update_user_account_provider(): array { return [ 'Full PII included in both auths, no picture in either' => [ - 'first_launch_data' => [ + 'firstlaunchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' )[0] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -1173,7 +1173,7 @@ final class auth_test extends \advanced_testcase { ] ], 'No PII included in both auths, no picture in either' => [ - 'first_launch_data' => [ + 'firstlaunchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -1181,7 +1181,7 @@ final class auth_test extends \advanced_testcase { false )[0] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -1196,7 +1196,7 @@ final class auth_test extends \advanced_testcase { ] ], 'First auth no PII, second auth including PII, no picture in either' => [ - 'first_launch_data' => [ + 'firstlaunchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -1204,7 +1204,7 @@ final class auth_test extends \advanced_testcase { false )[0] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' @@ -1217,13 +1217,13 @@ final class auth_test extends \advanced_testcase { ] ], 'First auth full PII, second auth no PII, no picture in either' => [ - 'first_launch_data' => [ + 'firstlaunchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', )[0] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -1238,13 +1238,13 @@ final class auth_test extends \advanced_testcase { ] ], 'First auth full PII, second auth emails only, no picture in either' => [ - 'first_launch_data' => [ + 'firstlaunchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', )[0] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -1258,13 +1258,13 @@ final class auth_test extends \advanced_testcase { ] ], 'First auth full PII, second auth names only, no picture in either' => [ - 'first_launch_data' => [ + 'firstlaunchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', )[0] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', @@ -1279,13 +1279,13 @@ final class auth_test extends \advanced_testcase { ] ], 'Full PII included in both auths, picture included in the second auth' => [ - 'first_launch_data' => [ + 'firstlaunchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner' )[0] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_users_with_ids( ['1'], 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner', diff --git a/blocks/comments/tests/privacy/provider_test.php b/blocks/comments/tests/privacy/provider_test.php index 539018b8bec..d5106055ef2 100644 --- a/blocks/comments/tests/privacy/provider_test.php +++ b/blocks/comments/tests/privacy/provider_test.php @@ -212,7 +212,7 @@ final class provider_test extends \core_privacy\tests\provider_testcase { $this->assertCount(2, $contextlist); $contextids = $contextlist->get_contextids(); - $this->assertEqualsCanonicalizing([$coursecontext1->id, $coursecontext2->id], $contextids); + $this->assertEqualsCanonicalizing([$coursecontext1->id, $coursecontext2->id], array_values($contextids)); } /** diff --git a/cache/stores/redis/tests/compressor_test.php b/cache/stores/redis/tests/compressor_test.php index d213c690936..a10dc6e2e87 100644 --- a/cache/stores/redis/tests/compressor_test.php +++ b/cache/stores/redis/tests/compressor_test.php @@ -178,11 +178,6 @@ final class compressor_test extends \advanced_testcase { * @return array */ public static function provider_for_tests_setget(): array { - if (!cachestore_redis::are_requirements_met()) { - // Even though we skip all tests in this case, this provider can still show warnings about non-existing class. - return []; - } - $data = [ ['none, none', \Redis::SERIALIZER_NONE, cachestore_redis::COMPRESSOR_NONE, @@ -239,6 +234,7 @@ final class compressor_test extends \advanced_testcase { * Test we can use get and set with all combinations. * * @dataProvider provider_for_tests_setget + * @requires extension Redis * @param string $name * @param int $serializer * @param int $compressor @@ -263,6 +259,7 @@ final class compressor_test extends \advanced_testcase { * Test we can use get and set many with all combinations. * * @dataProvider provider_for_tests_setget + * @requires extension Redis * @param string $name * @param int $serializer * @param int $compressor diff --git a/cache/tests/fixtures/stores.php b/cache/tests/fixtures/stores.php index 55f89c95b38..25a77fb6a17 100644 --- a/cache/tests/fixtures/stores.php +++ b/cache/tests/fixtures/stores.php @@ -104,10 +104,10 @@ abstract class cachestore_tests extends advanced_testcase { // Test find and find with prefix if this class implements the searchable interface. if ($instance->is_searchable()) { // Extra settings here ignore the return order of the array. - $this->assertEqualsCanonicalizing(['test3', 'test1', 'test2', 'other3'], $instance->find_all()); + $this->assertEqualsCanonicalizing(['test3', 'test1', 'test2', 'other3'], array_values($instance->find_all())); // Extra settings here ignore the return order of the array. - $this->assertEqualsCanonicalizing(['test2', 'test1', 'test3'], $instance->find_by_prefix('test')); + $this->assertEqualsCanonicalizing(['test2', 'test1', 'test3'], array_values($instance->find_by_prefix('test'))); $this->assertEquals(['test2'], $instance->find_by_prefix('test2')); $this->assertEquals(['other3'], $instance->find_by_prefix('other')); $this->assertEquals([], $instance->find_by_prefix('nothere')); diff --git a/calendar/tests/event_factory_test.php b/calendar/tests/event_factory_test.php index 6a10d28f7c6..d89539c46df 100644 --- a/calendar/tests/event_factory_test.php +++ b/calendar/tests/event_factory_test.php @@ -379,8 +379,8 @@ final class event_factory_test extends \advanced_testcase { 'bailoutcheck' => function() { return false; }, - event_interface::class, - 'Hello' + 'expectedclass' => event_interface::class, + 'expectedattributevalue' => 'Hello' ], 'Sample event record with event hidden' => [ 'dbrow' => (object)[ @@ -413,8 +413,8 @@ final class event_factory_test extends \advanced_testcase { 'bailoutcheck' => function() { return false; }, - null, - null + 'expectedclass' => null, + 'expectedattributevalue' => null ], 'Sample event record with early bail' => [ 'dbrow' => (object)[ @@ -447,8 +447,8 @@ final class event_factory_test extends \advanced_testcase { 'bailoutcheck' => function() { return true; }, - null, - null + 'expectedclass' => null, + 'expectedattributevalue' => null ] ]; } diff --git a/communication/provider/matrix/tests/local/command_test.php b/communication/provider/matrix/tests/local/command_test.php index 796a32866f9..5afa5b99c13 100644 --- a/communication/provider/matrix/tests/local/command_test.php +++ b/communication/provider/matrix/tests/local/command_test.php @@ -352,7 +352,7 @@ final class command_test extends \advanced_testcase { public static function sendasjson_provider(): array { return [ 'As JSON' => [ - 'sendasjon' => true, + 'sendasjson' => true, 'endpoint' => 'example/:id/endpoint', 'params' => [ ':id' => 12345, diff --git a/composer.json b/composer.json index 45fde0b9648..a92ccc09b84 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "type": "project", "homepage": "https://moodle.org", "require-dev": { - "phpunit/phpunit": "^9.6.18", + "phpunit/phpunit": "^11", "mikey179/vfsstream": "1.6.*", "behat/mink": "^1.11.0", "friends-of-behat/mink-extension": "^2.7.5", @@ -20,6 +20,10 @@ "autoload-dev": { "psr-0": { "Moodle\\BehatExtension": "lib/behat/extension/" + }, + "psr-4": { + "core_testing\\": "lib/testing/classes/", + "core_phpunit\\": "lib/phpunit/classes/" } }, "minimum-stability": "dev", diff --git a/composer.lock b/composer.lock index 36828e22f98..aff6c10b993 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "12f19cbc394d717d57ac0f5768dbc35a", + "content-hash": "6b9deaf56061694ff83824fd371c3d97", "packages": [ { "name": "behat/gherkin", @@ -341,76 +341,6 @@ }, "time": "2022-03-30T09:27:43+00:00" }, - { - "name": "doctrine/instantiator", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "require-dev": { - "doctrine/coding-standard": "^11", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-12-30T00:23:10+00:00" - }, { "name": "filp/whoops", "version": "2.16.0", @@ -729,16 +659,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.3.1", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" + "reference": "447a020a1f875a434d62f2a401f53b82a396e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", + "reference": "447a020a1f875a434d62f2a401f53b82a396e494", "shasum": "" }, "require": { @@ -781,9 +711,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" }, - "time": "2024-10-08T18:51:32+00:00" + "time": "2024-12-30T11:07:19+00:00" }, { "name": "oleg-andreyev/mink-phpwebdriver", @@ -1037,35 +967,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.32", + "version": "11.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/418c59fd080954f8c4aa5631d9502ecda2387118", + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.19.1 || ^5.1.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-text-template": "^2.0.4", - "sebastian/code-unit-reverse-lookup": "^2.0.3", - "sebastian/complexity": "^2.0.3", - "sebastian/environment": "^5.1.5", - "sebastian/lines-of-code": "^1.0.4", - "sebastian/version": "^3.0.2", + "nikic/php-parser": "^5.3.1", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-text-template": "^4.0.1", + "sebastian/code-unit-reverse-lookup": "^4.0.1", + "sebastian/complexity": "^4.0.1", + "sebastian/environment": "^7.2.0", + "sebastian/lines-of-code": "^3.0.1", + "sebastian/version": "^5.0.2", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^11.5.0" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -1074,7 +1004,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "9.2.x-dev" + "dev-main": "11.0.x-dev" } }, "autoload": { @@ -1103,7 +1033,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.8" }, "funding": [ { @@ -1111,32 +1041,32 @@ "type": "github" } ], - "time": "2024-08-22T04:23:01+00:00" + "time": "2024-12-11T12:34:27+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1163,7 +1093,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" }, "funding": [ { @@ -1171,28 +1102,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2024-08-27T05:02:59+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcntl": "*" @@ -1200,7 +1131,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1226,7 +1157,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" }, "funding": [ { @@ -1234,32 +1166,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2024-07-03T05:07:44+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1285,7 +1217,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" }, "funding": [ { @@ -1293,32 +1226,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2024-07-03T05:08:43+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1344,7 +1277,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" }, "funding": [ { @@ -1352,54 +1286,52 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2024-07-03T05:09:35+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.21", + "version": "11.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa" + "reference": "153d0531b9f7e883c5053160cad6dd5ac28140b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", - "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/153d0531b9f7e883c5053160cad6dd5ac28140b3", + "reference": "153d0531b9f7e883c5053160cad6dd5ac28140b3", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.12.0", + "myclabs/deep-copy": "^1.12.1", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.32", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.4", - "phpunit/php-timer": "^5.0.3", - "sebastian/cli-parser": "^1.0.2", - "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.6", - "sebastian/environment": "^5.1.5", - "sebastian/exporter": "^4.0.6", - "sebastian/global-state": "^5.0.7", - "sebastian/object-enumerator": "^4.0.4", - "sebastian/resource-operations": "^3.0.4", - "sebastian/type": "^3.2.1", - "sebastian/version": "^3.0.2" + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0.8", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.2", + "sebastian/comparator": "^6.2.1", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.0", + "sebastian/exporter": "^6.3.0", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/type": "^5.1.0", + "sebastian/version": "^5.0.2", + "staabm/side-effects-detector": "^1.0.5" }, "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -1407,7 +1339,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "11.5-dev" } }, "autoload": { @@ -1439,7 +1371,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.21" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.2" }, "funding": [ { @@ -1455,7 +1387,7 @@ "type": "tidelift" } ], - "time": "2024-09-19T10:50:18+00:00" + "time": "2024-12-21T05:51:08+00:00" }, { "name": "psr/container", @@ -1612,28 +1544,28 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.2", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1656,7 +1588,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" }, "funding": [ { @@ -1664,32 +1597,32 @@ "type": "github" } ], - "time": "2024-03-02T06:27:43+00:00" + "time": "2024-07-03T04:41:36+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1712,7 +1645,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.2" }, "funding": [ { @@ -1720,32 +1654,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2024-12-12T09:59:06+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "183a9b2632194febd219bb9246eee421dad8d45e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1767,7 +1701,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" }, "funding": [ { @@ -1775,34 +1710,39 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2024-07-03T04:45:54+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "d4e47a769525c4dd38cea90e5dcd435ddbbc7115" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/d4e47a769525c4dd38cea90e5dcd435ddbbc7115", + "reference": "d4e47a769525c4dd38cea90e5dcd435ddbbc7115", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.4" + }, + "suggest": { + "ext-bcmath": "For comparing BcMath\\Number objects" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.2-dev" } }, "autoload": { @@ -1841,7 +1781,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.0" }, "funding": [ { @@ -1849,33 +1790,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2025-01-06T10:28:19+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1898,7 +1839,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" }, "funding": [ { @@ -1906,33 +1848,33 @@ "type": "github" } ], - "time": "2023-12-22T06:19:30+00:00" + "time": "2024-07-03T04:49:50+00:00" }, { "name": "sebastian/diff", - "version": "4.0.6", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^11.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1964,7 +1906,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" }, "funding": [ { @@ -1972,27 +1915,27 @@ "type": "github" } ], - "time": "2024-03-02T06:30:58+00:00" + "time": "2024-07-03T04:53:05+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "7.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-posix": "*" @@ -2000,7 +1943,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "7.2-dev" } }, "autoload": { @@ -2019,7 +1962,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -2027,7 +1970,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.0" }, "funding": [ { @@ -2035,34 +1979,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2024-07-03T04:54:44+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.6", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/3473f61172093b2da7de1fb5782e1f24cc036dc3", + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -2104,7 +2048,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.0" }, "funding": [ { @@ -2112,38 +2057,35 @@ "type": "github" } ], - "time": "2024-03-02T06:33:00+00:00" + "time": "2024-12-05T09:17:50+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "7.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "3be331570a721f9a4b5917f4209773de17f747d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -2162,13 +2104,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" }, "funding": [ { @@ -2176,33 +2119,33 @@ "type": "github" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2024-07-03T04:57:36+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2225,7 +2168,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" }, "funding": [ { @@ -2233,34 +2177,34 @@ "type": "github" } ], - "time": "2023-12-22T06:20:34+00:00" + "time": "2024-07-03T04:58:38+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "f5b498e631a74204185071eb41f33f38d64608aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2282,7 +2226,8 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" }, "funding": [ { @@ -2290,32 +2235,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2024-07-03T05:00:13+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2337,7 +2282,8 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" }, "funding": [ { @@ -2345,32 +2291,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2024-07-03T05:01:32+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2400,7 +2346,8 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" }, "funding": [ { @@ -2408,86 +2355,32 @@ "type": "github" } ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-14T16:00:52+00:00" + "time": "2024-07-03T05:10:34+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/461b9c5da241511a2a0e8f240814fb23ce5c0aac", + "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -2510,7 +2403,8 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.1.0" }, "funding": [ { @@ -2518,29 +2412,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2024-09-17T13:12:04+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2563,7 +2457,8 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" }, "funding": [ { @@ -2571,20 +2466,72 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2024-10-09T05:16:32+00:00" }, { - "name": "symfony/browser-kit", - "version": "v7.1.6", + "name": "staabm/side-effects-detector", + "version": "1.0.5", "source": { "type": "git", - "url": "https://github.com/symfony/browser-kit.git", - "reference": "714becc9ba9b20115ffededc58f6b7172dc394cf" + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/714becc9ba9b20115ffededc58f6b7172dc394cf", - "reference": "714becc9ba9b20115ffededc58f6b7172dc394cf", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00" + }, + { + "name": "symfony/browser-kit", + "version": "v7.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/browser-kit.git", + "reference": "8d64d17e198082f8f198d023a6b634e7b5fdda94" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/8d64d17e198082f8f198d023a6b634e7b5fdda94", + "reference": "8d64d17e198082f8f198d023a6b634e7b5fdda94", "shasum": "" }, "require": { @@ -2623,7 +2570,7 @@ "description": "Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/browser-kit/tree/v7.1.6" + "source": "https://github.com/symfony/browser-kit/tree/v7.2.0" }, "funding": [ { @@ -2639,20 +2586,20 @@ "type": "tidelift" } ], - "time": "2024-10-25T15:11:02+00:00" + "time": "2024-10-25T15:15:23+00:00" }, { "name": "symfony/config", - "version": "v7.1.7", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "dc373a5cbd345354696f5dfd39c5c7a8ea23f4c8" + "reference": "bcd3c4adf0144dee5011bb35454728c38adec055" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/dc373a5cbd345354696f5dfd39c5c7a8ea23f4c8", - "reference": "dc373a5cbd345354696f5dfd39c5c7a8ea23f4c8", + "url": "https://api.github.com/repos/symfony/config/zipball/bcd3c4adf0144dee5011bb35454728c38adec055", + "reference": "bcd3c4adf0144dee5011bb35454728c38adec055", "shasum": "" }, "require": { @@ -2698,7 +2645,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v7.1.7" + "source": "https://github.com/symfony/config/tree/v7.2.0" }, "funding": [ { @@ -2714,20 +2661,20 @@ "type": "tidelift" } ], - "time": "2024-11-04T11:34:07+00:00" + "time": "2024-11-04T11:36:24+00:00" }, { "name": "symfony/console", - "version": "v7.1.8", + "version": "v7.2.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5" + "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ff04e5b5ba043d2badfb308197b9e6b42883fcd5", - "reference": "ff04e5b5ba043d2badfb308197b9e6b42883fcd5", + "url": "https://api.github.com/repos/symfony/console/zipball/fefcc18c0f5d0efe3ab3152f15857298868dc2c3", + "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3", "shasum": "" }, "require": { @@ -2791,7 +2738,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.8" + "source": "https://github.com/symfony/console/tree/v7.2.1" }, "funding": [ { @@ -2807,20 +2754,20 @@ "type": "tidelift" } ], - "time": "2024-11-06T14:23:19+00:00" + "time": "2024-12-11T03:49:26+00:00" }, { "name": "symfony/css-selector", - "version": "v7.1.6", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "4aa4f6b3d6749c14d3aa815eef8226632e7bbc66" + "reference": "601a5ce9aaad7bf10797e3663faefce9e26c24e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/4aa4f6b3d6749c14d3aa815eef8226632e7bbc66", - "reference": "4aa4f6b3d6749c14d3aa815eef8226632e7bbc66", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/601a5ce9aaad7bf10797e3663faefce9e26c24e2", + "reference": "601a5ce9aaad7bf10797e3663faefce9e26c24e2", "shasum": "" }, "require": { @@ -2856,7 +2803,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v7.1.6" + "source": "https://github.com/symfony/css-selector/tree/v7.2.0" }, "funding": [ { @@ -2872,20 +2819,20 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/dependency-injection", - "version": "v7.1.8", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "e4d13f0f394f4d02a041ff76acd31c5a20a5f70b" + "reference": "a475747af1a1c98272a5471abc35f3da81197c5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e4d13f0f394f4d02a041ff76acd31c5a20a5f70b", - "reference": "e4d13f0f394f4d02a041ff76acd31c5a20a5f70b", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/a475747af1a1c98272a5471abc35f3da81197c5d", + "reference": "a475747af1a1c98272a5471abc35f3da81197c5d", "shasum": "" }, "require": { @@ -2936,7 +2883,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v7.1.8" + "source": "https://github.com/symfony/dependency-injection/tree/v7.2.0" }, "funding": [ { @@ -2952,20 +2899,20 @@ "type": "tidelift" } ], - "time": "2024-11-09T09:16:45+00:00" + "time": "2024-11-25T15:45:00+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", "shasum": "" }, "require": { @@ -2973,12 +2920,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3003,7 +2950,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" }, "funding": [ { @@ -3019,20 +2966,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/dom-crawler", - "version": "v7.1.6", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "794ddd5481ba15d8a04132c95e211cd5656e09fb" + "reference": "b176e1f1f550ef44c94eb971bf92488de08f7c6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/794ddd5481ba15d8a04132c95e211cd5656e09fb", - "reference": "794ddd5481ba15d8a04132c95e211cd5656e09fb", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/b176e1f1f550ef44c94eb971bf92488de08f7c6b", + "reference": "b176e1f1f550ef44c94eb971bf92488de08f7c6b", "shasum": "" }, "require": { @@ -3070,7 +3017,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v7.1.6" + "source": "https://github.com/symfony/dom-crawler/tree/v7.2.0" }, "funding": [ { @@ -3086,20 +3033,20 @@ "type": "tidelift" } ], - "time": "2024-10-25T15:11:02+00:00" + "time": "2024-11-13T16:15:23+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v7.1.6", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "87254c78dd50721cfd015b62277a8281c5589702" + "reference": "910c5db85a5356d0fea57680defec4e99eb9c8c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87254c78dd50721cfd015b62277a8281c5589702", - "reference": "87254c78dd50721cfd015b62277a8281c5589702", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/910c5db85a5356d0fea57680defec4e99eb9c8c1", + "reference": "910c5db85a5356d0fea57680defec4e99eb9c8c1", "shasum": "" }, "require": { @@ -3150,7 +3097,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v7.1.6" + "source": "https://github.com/symfony/event-dispatcher/tree/v7.2.0" }, "funding": [ { @@ -3166,20 +3113,20 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50" + "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/8f93aec25d41b72493c6ddff14e916177c9efc50", - "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7642f5e970b672283b7823222ae8ef8bbc160b9f", + "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f", "shasum": "" }, "require": { @@ -3188,12 +3135,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3226,7 +3173,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.1" }, "funding": [ { @@ -3242,20 +3189,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/filesystem", - "version": "v7.1.6", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "c835867b3c62bb05c7fe3d637c871c7ae52024d4" + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c835867b3c62bb05c7fe3d637c871c7ae52024d4", - "reference": "c835867b3c62bb05c7fe3d637c871c7ae52024d4", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b8dce482de9d7c9fe2891155035a7248ab5c7fdb", + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb", "shasum": "" }, "require": { @@ -3292,7 +3239,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.1.6" + "source": "https://github.com/symfony/filesystem/tree/v7.2.0" }, "funding": [ { @@ -3308,30 +3255,31 @@ "type": "tidelift" } ], - "time": "2024-10-25T15:11:02+00:00" + "time": "2024-10-25T15:15:23+00:00" }, { "name": "symfony/http-client", - "version": "v7.1.8", + "version": "v7.2.2", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "c30d91a1deac0dc3ed5e604683cf2e1dfc635b8a" + "reference": "339ba21476eb184290361542f732ad12c97591ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/c30d91a1deac0dc3ed5e604683cf2e1dfc635b8a", - "reference": "c30d91a1deac0dc3ed5e604683cf2e1dfc635b8a", + "url": "https://api.github.com/repos/symfony/http-client/zipball/339ba21476eb184290361542f732ad12c97591ec", + "reference": "339ba21476eb184290361542f732ad12c97591ec", "shasum": "" }, "require": { "php": ">=8.2", "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-client-contracts": "^3.4.1", + "symfony/http-client-contracts": "~3.4.4|^3.5.2", "symfony/service-contracts": "^2.5|^3" }, "conflict": { + "amphp/amp": "<2.5", "php-http/discovery": "<1.15", "symfony/http-foundation": "<6.4" }, @@ -3342,14 +3290,14 @@ "symfony/http-client-implementation": "3.0" }, "require-dev": { - "amphp/amp": "^2.5", - "amphp/http-client": "^4.2.1", - "amphp/http-tunnel": "^1.0", + "amphp/http-client": "^4.2.1|^5.0", + "amphp/http-tunnel": "^1.0|^2.0", "amphp/socket": "^1.1", "guzzlehttp/promises": "^1.4|^2.0", "nyholm/psr7": "^1.0", "php-http/httplug": "^1.0|^2.0", "psr/http-client": "^1.0", + "symfony/amphp-http-client-meta": "^1.0|^2.0", "symfony/dependency-injection": "^6.4|^7.0", "symfony/http-kernel": "^6.4|^7.0", "symfony/messenger": "^6.4|^7.0", @@ -3386,7 +3334,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.1.8" + "source": "https://github.com/symfony/http-client/tree/v7.2.2" }, "funding": [ { @@ -3402,20 +3350,20 @@ "type": "tidelift" } ], - "time": "2024-11-13T13:40:27+00:00" + "time": "2024-12-30T18:35:15+00:00" }, { "name": "symfony/http-client-contracts", - "version": "v3.5.0", + "version": "v3.5.2", "source": { "type": "git", "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "20414d96f391677bf80078aa55baece78b82647d" + "reference": "ee8d807ab20fcb51267fdace50fbe3494c31e645" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/20414d96f391677bf80078aa55baece78b82647d", - "reference": "20414d96f391677bf80078aa55baece78b82647d", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ee8d807ab20fcb51267fdace50fbe3494c31e645", + "reference": "ee8d807ab20fcb51267fdace50fbe3494c31e645", "shasum": "" }, "require": { @@ -3423,12 +3371,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3464,7 +3412,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.2" }, "funding": [ { @@ -3480,20 +3428,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-12-07T08:49:48+00:00" }, { "name": "symfony/mime", - "version": "v7.1.6", + "version": "v7.2.1", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "caa1e521edb2650b8470918dfe51708c237f0598" + "reference": "7f9617fcf15cb61be30f8b252695ed5e2bfac283" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/caa1e521edb2650b8470918dfe51708c237f0598", - "reference": "caa1e521edb2650b8470918dfe51708c237f0598", + "url": "https://api.github.com/repos/symfony/mime/zipball/7f9617fcf15cb61be30f8b252695ed5e2bfac283", + "reference": "7f9617fcf15cb61be30f8b252695ed5e2bfac283", "shasum": "" }, "require": { @@ -3548,7 +3496,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v7.1.6" + "source": "https://github.com/symfony/mime/tree/v7.2.1" }, "funding": [ { @@ -3564,7 +3512,7 @@ "type": "tidelift" } ], - "time": "2024-10-25T15:11:02+00:00" + "time": "2024-12-07T08:50:44+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3592,8 +3540,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3668,8 +3616,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3747,8 +3695,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3829,8 +3777,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3913,8 +3861,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3969,16 +3917,16 @@ }, { "name": "symfony/process", - "version": "v7.1.8", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892" + "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/42783370fda6e538771f7c7a36e9fa2ee3a84892", - "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892", + "url": "https://api.github.com/repos/symfony/process/zipball/d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", + "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", "shasum": "" }, "require": { @@ -4010,7 +3958,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.8" + "source": "https://github.com/symfony/process/tree/v7.2.0" }, "funding": [ { @@ -4026,20 +3974,20 @@ "type": "tidelift" } ], - "time": "2024-11-06T14:23:19+00:00" + "time": "2024-11-06T14:24:19+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0", + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0", "shasum": "" }, "require": { @@ -4052,12 +4000,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -4093,7 +4041,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.5.1" }, "funding": [ { @@ -4109,20 +4057,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/string", - "version": "v7.1.8", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "591ebd41565f356fcd8b090fe64dbb5878f50281" + "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/591ebd41565f356fcd8b090fe64dbb5878f50281", - "reference": "591ebd41565f356fcd8b090fe64dbb5878f50281", + "url": "https://api.github.com/repos/symfony/string/zipball/446e0d146f991dde3e73f45f2c97a9faad773c82", + "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82", "shasum": "" }, "require": { @@ -4180,7 +4128,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.8" + "source": "https://github.com/symfony/string/tree/v7.2.0" }, "funding": [ { @@ -4196,24 +4144,25 @@ "type": "tidelift" } ], - "time": "2024-11-13T13:31:21+00:00" + "time": "2024-11-13T13:31:26+00:00" }, { "name": "symfony/translation", - "version": "v7.1.6", + "version": "v7.2.2", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "b9f72ab14efdb6b772f85041fa12f820dee8d55f" + "reference": "e2674a30132b7cc4d74540d6c2573aa363f05923" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/b9f72ab14efdb6b772f85041fa12f820dee8d55f", - "reference": "b9f72ab14efdb6b772f85041fa12f820dee8d55f", + "url": "https://api.github.com/repos/symfony/translation/zipball/e2674a30132b7cc4d74540d6c2573aa363f05923", + "reference": "e2674a30132b7cc4d74540d6c2573aa363f05923", "shasum": "" }, "require": { "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", "symfony/translation-contracts": "^2.5|^3.0" }, @@ -4274,7 +4223,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v7.1.6" + "source": "https://github.com/symfony/translation/tree/v7.2.2" }, "funding": [ { @@ -4290,20 +4239,20 @@ "type": "tidelift" } ], - "time": "2024-09-28T12:35:13+00:00" + "time": "2024-12-07T08:18:10+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "b9d2189887bb6b2e0367a9fc7136c5239ab9b05a" + "reference": "4667ff3bd513750603a09c8dedbea942487fb07c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/b9d2189887bb6b2e0367a9fc7136c5239ab9b05a", - "reference": "b9d2189887bb6b2e0367a9fc7136c5239ab9b05a", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/4667ff3bd513750603a09c8dedbea942487fb07c", + "reference": "4667ff3bd513750603a09c8dedbea942487fb07c", "shasum": "" }, "require": { @@ -4311,12 +4260,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -4352,7 +4301,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/translation-contracts/tree/v3.5.1" }, "funding": [ { @@ -4368,20 +4317,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/var-exporter", - "version": "v7.1.6", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "90173ef89c40e7c8c616653241048705f84130ef" + "reference": "1a6a89f95a46af0f142874c9d650a6358d13070d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/90173ef89c40e7c8c616653241048705f84130ef", - "reference": "90173ef89c40e7c8c616653241048705f84130ef", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/1a6a89f95a46af0f142874c9d650a6358d13070d", + "reference": "1a6a89f95a46af0f142874c9d650a6358d13070d", "shasum": "" }, "require": { @@ -4428,7 +4377,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v7.1.6" + "source": "https://github.com/symfony/var-exporter/tree/v7.2.0" }, "funding": [ { @@ -4444,24 +4393,25 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-10-18T07:58:17+00:00" }, { "name": "symfony/yaml", - "version": "v7.1.6", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "3ced3f29e4f0d6bce2170ff26719f1fe9aacc671" + "reference": "099581e99f557e9f16b43c5916c26380b54abb22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/3ced3f29e4f0d6bce2170ff26719f1fe9aacc671", - "reference": "3ced3f29e4f0d6bce2170ff26719f1fe9aacc671", + "url": "https://api.github.com/repos/symfony/yaml/zipball/099581e99f557e9f16b43c5916c26380b54abb22", + "reference": "099581e99f557e9f16b43c5916c26380b54abb22", "shasum": "" }, "require": { "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -4499,7 +4449,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v7.1.6" + "source": "https://github.com/symfony/yaml/tree/v7.2.0" }, "funding": [ { @@ -4515,7 +4465,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-10-23T06:56:12+00:00" }, { "name": "theseer/tokenizer", diff --git a/course/format/tests/local/sectionactions_test.php b/course/format/tests/local/sectionactions_test.php index 00a57a66854..9d159c577db 100644 --- a/course/format/tests/local/sectionactions_test.php +++ b/course/format/tests/local/sectionactions_test.php @@ -268,27 +268,27 @@ final class sectionactions_test extends \advanced_testcase { public static function create_if_missing_provider(): array { return [ 'existing section' => [ - 'sectionnum' => [1], + 'sectionnums' => [1], 'expected' => false, ], 'unexisting section' => [ - 'sectionnum' => [3], + 'sectionnums' => [3], 'expected' => true, ], 'several existing sections' => [ - 'sectionnum' => [1, 2], + 'sectionnums' => [1, 2], 'expected' => false, ], 'several unexisting sections' => [ - 'sectionnum' => [3, 4], + 'sectionnums' => [3, 4], 'expected' => true, ], 'empty array' => [ - 'sectionnum' => [], + 'sectionnums' => [], 'expected' => false, ], 'existent and unexistent sections' => [ - 'sectionnum' => [1, 2, 3, 4], + 'sectionnums' => [1, 2, 3, 4], 'expected' => true, ], ]; diff --git a/course/format/tests/stateactions_test.php b/course/format/tests/stateactions_test.php index afea511509e..7c8e25376e6 100644 --- a/course/format/tests/stateactions_test.php +++ b/course/format/tests/stateactions_test.php @@ -1566,7 +1566,7 @@ final class stateactions_test extends \advanced_testcase { 'cmtomove' => ['subsection1'], // When moving a subsection we actually move the delegated module. 'targetsection' => 'subsection2', 'expectedcoursetree' => [], - 'exception' => 'error/subsectionmoveerror', + 'expectedexception' => 'error/subsectionmoveerror', ], 'Move module into subsection' => [ 'cmtomove' => ['cm1'], diff --git a/course/format/topics/tests/courseformat/stateactions_test.php b/course/format/topics/tests/courseformat/stateactions_test.php index f48cc510fc0..ebe1938eeba 100644 --- a/course/format/topics/tests/courseformat/stateactions_test.php +++ b/course/format/topics/tests/courseformat/stateactions_test.php @@ -194,27 +194,27 @@ final class stateactions_test extends \advanced_testcase { public static function basic_role_provider(): array { return [ 'admin' => [ - 'role' => 'admin', + 'rolename' => 'admin', 'expectedexception' => false, ], 'editingteacher' => [ - 'role' => 'editingteacher', + 'rolename' => 'editingteacher', 'expectedexception' => false, ], 'teacher' => [ - 'role' => 'teacher', + 'rolename' => 'teacher', 'expectedexception' => true, ], 'student' => [ - 'role' => 'student', + 'rolename' => 'student', 'expectedexception' => true, ], 'guest' => [ - 'role' => 'guest', + 'rolename' => 'guest', 'expectedexception' => true, ], 'unenroled' => [ - 'role' => 'unenroled', + 'rolename' => 'unenroled', 'expectedexception' => true, ], ]; diff --git a/course/tests/courselib_test.php b/course/tests/courselib_test.php index 8021886e338..5d4d1d42385 100644 --- a/course/tests/courselib_test.php +++ b/course/tests/courselib_test.php @@ -2008,7 +2008,10 @@ final class courselib_test extends advanced_testcase { // Create the XML file we want to use. $course->category = (array)$course->category; - $imstestcase = new imsenterprise_test(); + + // Note: this is a violation of component communication principles. + // TODO MDL-83789. + $imstestcase = new imsenterprise_test('courselib_imsenterprise_test'); $imstestcase->imsplugin = enrol_get_plugin('imsenterprise'); $imstestcase->set_test_config(); $imstestcase->set_xml_file(false, array($course)); diff --git a/course/tests/targets_test.php b/course/tests/targets_test.php index e97717d496d..56521dfad29 100644 --- a/course/tests/targets_test.php +++ b/course/tests/targets_test.php @@ -48,14 +48,14 @@ final class targets_test extends \advanced_testcase { return [ 'coursenotyetstarted' => [ - 'params' => [ + 'courseparams' => [ 'enablecompletion' => 1, 'startdate' => mktime(0, 0, 0, 10, 24, $year + 1) ], 'isvalid' => get_string('coursenotyetstarted', 'course') ], 'coursenostudents' => [ - 'params' => [ + 'courseparams' => [ 'enablecompletion' => 1, 'startdate' => mktime(0, 0, 0, 10, 24, $year - 2), 'enddate' => mktime(0, 0, 0, 10, 24, $year - 1) @@ -63,7 +63,7 @@ final class targets_test extends \advanced_testcase { 'isvalid' => get_string('nocoursestudents', 'course') ], 'coursenosections' => [ - 'params' => [ + 'courseparams' => [ 'enablecompletion' => 1, 'format' => 'singleactivity', 'students' => true @@ -71,7 +71,7 @@ final class targets_test extends \advanced_testcase { 'isvalid' => get_string('nocoursesections', 'course') ], 'coursenoendtime' => [ - 'params' => [ + 'courseparams' => [ 'enablecompletion' => 1, 'format' => 'topics', 'enddate' => 0, @@ -80,7 +80,7 @@ final class targets_test extends \advanced_testcase { 'isvalid' => get_string('nocourseendtime', 'course') ], 'courseendbeforestart' => [ - 'params' => [ + 'courseparams' => [ 'enablecompletion' => 1, 'enddate' => mktime(0, 0, 0, 10, 23, $year - 2), 'students' => true @@ -88,7 +88,7 @@ final class targets_test extends \advanced_testcase { 'isvalid' => get_string('errorendbeforestart', 'course') ], 'coursetoolong' => [ - 'params' => [ + 'courseparams' => [ 'enablecompletion' => 1, 'startdate' => mktime(0, 0, 0, 10, 24, $year - 2), 'enddate' => mktime(0, 0, 0, 10, 23, $year), @@ -97,7 +97,7 @@ final class targets_test extends \advanced_testcase { 'isvalid' => get_string('coursetoolong', 'course') ], 'coursealreadyfinished' => [ - 'params' => [ + 'courseparams' => [ 'enablecompletion' => 1, 'startdate' => mktime(0, 0, 0, 10, 24, $year - 2), 'enddate' => mktime(0, 0, 0, 10, 23, $year - 1), @@ -107,7 +107,7 @@ final class targets_test extends \advanced_testcase { 'fortraining' => false ], 'coursenotyetfinished' => [ - 'params' => [ + 'courseparams' => [ 'enablecompletion' => 1, 'startdate' => mktime(0, 0, 0, $month - 1, 24, $year), 'enddate' => mktime(0, 0, 0, $month + 2, 23, $year), @@ -116,7 +116,7 @@ final class targets_test extends \advanced_testcase { 'isvalid' => get_string('coursenotyetfinished', 'course') ], 'coursenocompletion' => [ - 'params' => [ + 'courseparams' => [ 'enablecompletion' => 0, 'startdate' => mktime(0, 0, 0, $month - 2, 24, $year), 'enddate' => mktime(0, 0, 0, $month - 1, 23, $year), @@ -125,7 +125,7 @@ final class targets_test extends \advanced_testcase { 'isvalid' => get_string('completionnotenabledforcourse', 'completion') ], 'coursehiddentraining' => [ - 'params' => [ + 'courseparams' => [ 'enablecompletion' => 1, 'startdate' => mktime(0, 0, 0, $month - 1, 24, $year - 1), 'enddate' => mktime(0, 0, 0, $month - 1, 23, $year), @@ -135,7 +135,7 @@ final class targets_test extends \advanced_testcase { 'isvalid' => true, ], 'coursehiddenprediction' => [ - 'params' => [ + 'courseparams' => [ 'enablecompletion' => 1, 'startdate' => mktime(0, 0, 0, $month - 1, 24, $year), 'enddate' => mktime(0, 0, 0, $month - 1, 23, $year + 1), diff --git a/customfield/tests/privacy/provider_test.php b/customfield/tests/privacy/provider_test.php index d111d07cea1..542f227a4ec 100644 --- a/customfield/tests/privacy/provider_test.php +++ b/customfield/tests/privacy/provider_test.php @@ -117,9 +117,13 @@ final class provider_test extends provider_testcase { list($sql, $params) = $DB->get_in_or_equal([$courses[1]->id, $courses[2]->id], SQL_PARAMS_NAMED); $r = provider::get_customfields_data_contexts('core_course', 'course', '=0', $sql, $params); - $this->assertEqualsCanonicalizing([\context_course::instance($courses[1]->id)->id, - \context_course::instance($courses[2]->id)->id], - $r->get_contextids()); + $this->assertEqualsCanonicalizing( + [ + \context_course::instance($courses[1]->id)->id, + \context_course::instance($courses[2]->id)->id, + ], + array_values($r->get_contextids()), + ); } /** diff --git a/enrol/lti/tests/local/ltiadvantage/entity/migration_claim_test.php b/enrol/lti/tests/local/ltiadvantage/entity/migration_claim_test.php index fdd52780aa0..fb688ba3208 100644 --- a/enrol/lti/tests/local/ltiadvantage/entity/migration_claim_test.php +++ b/enrol/lti/tests/local/ltiadvantage/entity/migration_claim_test.php @@ -49,7 +49,7 @@ final class migration_claim_test extends \advanced_testcase { * Test instantiation and getters of the migration_claim. * * @dataProvider migration_claim_provider - * @param array $migrationclaimdata the lti1p1 migration claim. + * @param array $lti1p1migrationclaim the lti1p1 migration claim. * @param string $deploymentid string id of the tool deployment. * @param string $platform string url of the issuer. * @param string $clientid string id of the client. @@ -60,7 +60,7 @@ final class migration_claim_test extends \advanced_testcase { * @covers ::__construct */ public function test_migration_claim( - array $migrationclaimdata, + array $lti1p1migrationclaim, string $deploymentid, string $platform, string $clientid, @@ -79,7 +79,7 @@ final class migration_claim_test extends \advanced_testcase { $this->expectException($expected['exception']); $this->expectExceptionMessage($expected['exceptionmessage']); new migration_claim( - $migrationclaimdata, + $lti1p1migrationclaim, $deploymentid, $platform, $clientid, @@ -89,7 +89,7 @@ final class migration_claim_test extends \advanced_testcase { ); } else { $migrationclaim = new migration_claim( - $migrationclaimdata, + $lti1p1migrationclaim, $deploymentid, $platform, $clientid, diff --git a/enrol/lti/tests/local/ltiadvantage/repository/application_registration_repository_test.php b/enrol/lti/tests/local/ltiadvantage/repository/application_registration_repository_test.php index 140cef90c56..a87e9c7e54f 100644 --- a/enrol/lti/tests/local/ltiadvantage/repository/application_registration_repository_test.php +++ b/enrol/lti/tests/local/ltiadvantage/repository/application_registration_repository_test.php @@ -98,28 +98,28 @@ final class application_registration_repository_test extends \advanced_testcase * * @dataProvider save_data_provider * @covers ::save - * @param array $regdata the registration data + * @param array $registrationdata the registration data */ - public function test_save_new(array $regdata): void { + public function test_save_new(array $registrationdata): void { $this->resetAfterTest(); - $reg = application_registration::create_draft($regdata['name'], $regdata['uniqueid']); - if (isset($regdata['platformid'])) { - $reg->set_platformid($regdata['platformid']); + $reg = application_registration::create_draft($registrationdata['name'], $registrationdata['uniqueid']); + if (isset($registrationdata['platformid'])) { + $reg->set_platformid($registrationdata['platformid']); } - if (isset($regdata['clientid'])) { - $reg->set_clientid($regdata['clientid']); + if (isset($registrationdata['clientid'])) { + $reg->set_clientid($registrationdata['clientid']); } - if (isset($regdata['authenticationrequesturl'])) { - $reg->set_authenticationrequesturl($regdata['authenticationrequesturl']); + if (isset($registrationdata['authenticationrequesturl'])) { + $reg->set_authenticationrequesturl($registrationdata['authenticationrequesturl']); } - if (isset($regdata['jwksurl'])) { - $reg->set_jwksurl($regdata['jwksurl']); + if (isset($registrationdata['jwksurl'])) { + $reg->set_jwksurl($registrationdata['jwksurl']); } - if (isset($regdata['accesstokenurl'])) { - $reg->set_accesstokenurl($regdata['accesstokenurl']); + if (isset($registrationdata['accesstokenurl'])) { + $reg->set_accesstokenurl($registrationdata['accesstokenurl']); } - if (!empty($regdata['setcomplete'])) { + if (!empty($registrationdata['setcomplete'])) { $reg->complete_registration(); } $repository = new application_registration_repository(); diff --git a/enrol/lti/tests/local/ltiadvantage/service/tool_launch_service_test.php b/enrol/lti/tests/local/ltiadvantage/service/tool_launch_service_test.php index 4aee6ee44ed..73ace1b6bcb 100644 --- a/enrol/lti/tests/local/ltiadvantage/service/tool_launch_service_test.php +++ b/enrol/lti/tests/local/ltiadvantage/service/tool_launch_service_test.php @@ -126,8 +126,8 @@ final class tool_launch_service_test extends \lti_advantage_testcase { public static function user_launch_provider(): array { return [ 'New tool: no legacy data, no migration claim sent' => [ - 'legacy_data' => null, - 'launch_data' => [ + 'legacydata' => null, + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => null, ], @@ -136,14 +136,14 @@ final class tool_launch_service_test extends \lti_advantage_testcase { ] ], 'Migrated tool: Legacy data exists, no change in user_id so omitted from claim' => [ - 'legacy_data' => [ + 'legacydata' => [ 'consumer_key' => 'CONSUMER_1', 'tools' => [ ['secret' => 'toolsecret1'], ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1'])[0], 'launch_migration_claim' => [ 'consumer_key' => 'CONSUMER_1', @@ -159,14 +159,14 @@ final class tool_launch_service_test extends \lti_advantage_testcase { ], 'Migrated tool: Legacy data exists, platform signs with different valid secret' => [ - 'legacy_data' => [ + 'legacydata' => [ 'consumer_key' => 'CONSUMER_1', 'tools' => [ ['secret' => 'toolsecret1'], ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => [ 'consumer_key' => 'CONSUMER_1', @@ -181,14 +181,14 @@ final class tool_launch_service_test extends \lti_advantage_testcase { ] ], 'Migrated tool: Legacy data exists, no migration claim sent' => [ - 'legacy_data' => [ + 'legacydata' => [ 'consumer_key' => 'CONSUMER_1', 'tools' => [ ['secret' => 'toolsecret1'], ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => null, ], @@ -197,14 +197,14 @@ final class tool_launch_service_test extends \lti_advantage_testcase { ] ], 'Migrated tool: Legacy data exists, migration claim signature generated using invalid secret' => [ - 'legacy_data' => [ + 'legacydata' => [ 'consumer_key' => 'CONSUMER_1', 'tools' => [ ['secret' => 'toolsecret1'], ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => [ 'consumer_key' => 'CONSUMER_1', @@ -221,14 +221,14 @@ final class tool_launch_service_test extends \lti_advantage_testcase { ] ], 'Migrated tool: Legacy data exists, migration claim signature omitted' => [ - 'legacy_data' => [ + 'legacydata' => [ 'consumer_key' => 'CONSUMER_1', 'tools' => [ ['secret' => 'toolsecret1'], ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => [ 'consumer_key' => 'CONSUMER_1', @@ -244,14 +244,14 @@ final class tool_launch_service_test extends \lti_advantage_testcase { ] ], 'Migrated tool: Legacy data exists, migration claim missing oauth_consumer_key' => [ - 'legacy_data' => [ + 'legacydata' => [ 'consumer_key' => 'CONSUMER_1', 'tools' => [ ['secret' => 'toolsecret1'], ['secret' => 'toolsecret2'], ] ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => [ 'user_id' => 'user-id-123', diff --git a/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php b/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php index c827ac661de..526b393f2de 100644 --- a/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php +++ b/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php @@ -800,7 +800,7 @@ final class sync_members_test extends \lti_advantage_testcase { require_once($CFG->dirroot . '/auth/lti/auth.php'); return [ 'Migrated tool, user ids changed, new and existing users present in sync' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '1'], ['user_id' => '2'], @@ -811,8 +811,8 @@ final class sync_members_test extends \lti_advantage_testcase { ['secret' => 'toolsecret2'], ] ], - 'resource_config' => null, - 'launch_data' => [ + 'resourceconfig' => null, + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => [ 'consumer_key' => 'CONSUMER_1', @@ -823,7 +823,7 @@ final class sync_members_test extends \lti_advantage_testcase { 'resource_link_id' => '4b6fa' ], ], - 'sync_members_data' => [ + 'syncmembers' => [ self::get_mock_members_with_ids(['1p3_1'], ['1'])[0], self::get_mock_members_with_ids(['1p3_2'], ['2'])[0], self::get_mock_members_with_ids(['1p3_3'], ['3'])[0], @@ -851,7 +851,7 @@ final class sync_members_test extends \lti_advantage_testcase { ] ], 'Migrated tool, no change in user ids, new and existing users present in sync' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '1'], ['user_id' => '2'], @@ -862,8 +862,8 @@ final class sync_members_test extends \lti_advantage_testcase { ['secret' => 'toolsecret2'], ] ], - 'resource_config' => null, - 'launch_data' => [ + 'resourceconfig' => null, + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1'])[0], 'launch_migration_claim' => [ 'consumer_key' => 'CONSUMER_1', @@ -873,7 +873,7 @@ final class sync_members_test extends \lti_advantage_testcase { 'resource_link_id' => '4b6fa' ], ], - 'sync_members_data' => [ + 'syncmembers' => [ self::get_mock_members_with_ids(['1'], null)[0], self::get_mock_members_with_ids(['2'], null)[0], self::get_mock_members_with_ids(['3'], null)[0], @@ -901,7 +901,7 @@ final class sync_members_test extends \lti_advantage_testcase { ] ], 'New tool, no launch migration claim, change in user ids, new and existing users present in sync' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '1'], ['user_id' => '2'], @@ -912,12 +912,12 @@ final class sync_members_test extends \lti_advantage_testcase { ['secret' => 'toolsecret2'], ] ], - 'resource_config' => null, - 'launch_data' => [ + 'resourceconfig' => null, + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => null, ], - 'sync_members_data' => [ + 'syncmembers' => [ self::get_mock_members_with_ids(['1p3_1'], null)[0], self::get_mock_members_with_ids(['1p3_2'], null)[0], self::get_mock_members_with_ids(['1p3_3'], null)[0], @@ -945,7 +945,7 @@ final class sync_members_test extends \lti_advantage_testcase { ] ], 'New tool, no launch migration claim, no change in user ids, new and existing users present in sync' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '1'], ['user_id' => '2'], @@ -956,12 +956,12 @@ final class sync_members_test extends \lti_advantage_testcase { ['secret' => 'toolsecret2'], ] ], - 'resource_config' => null, - 'launch_data' => [ + 'resourceconfig' => null, + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1'])[0], 'launch_migration_claim' => null, ], - 'sync_members_data' => [ + 'syncmembers' => [ self::get_mock_members_with_ids(['1'], null)[0], self::get_mock_members_with_ids(['2'], null)[0], self::get_mock_members_with_ids(['3'], null)[0], @@ -989,7 +989,7 @@ final class sync_members_test extends \lti_advantage_testcase { ] ], 'New tool, migration only via member sync, no launch claim, new and existing users present in sync' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '1'], ['user_id' => '2'], @@ -1000,12 +1000,12 @@ final class sync_members_test extends \lti_advantage_testcase { ['secret' => 'toolsecret2'], ] ], - 'resource_config' => null, - 'launch_data' => [ + 'resourceconfig' => null, + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => null, ], - 'sync_members_data' => [ + 'syncmembers' => [ self::get_mock_members_with_ids(['1p3_1'], ['1'])[0], self::get_mock_members_with_ids(['1p3_2'], ['2'])[0], self::get_mock_members_with_ids(['1p3_3'], ['3'])[0], @@ -1033,16 +1033,16 @@ final class sync_members_test extends \lti_advantage_testcase { ] ], 'Default provisioning modes, mixed bag of users and roles' => [ - 'legacy_data' => null, - 'resource_config' => [ + 'legacydata' => null, + 'resourceconfig' => [ 'provisioningmodelearner' => \auth_plugin_lti::PROVISIONING_MODE_AUTO_ONLY, 'provisioningmodeinstructor' => \auth_plugin_lti::PROVISIONING_MODE_PROMPT_NEW_EXISTING ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => null, ], - 'sync_members_data' => [ + 'syncmembers' => [ // This user is just an instructor but is also the user who is already linked, via the launch above. self::get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [ 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor', @@ -1083,16 +1083,16 @@ final class sync_members_test extends \lti_advantage_testcase { ] ], 'All automatic provisioning, mixed bag of users and roles' => [ - 'legacy_data' => null, - 'resource_config' => [ + 'legacydata' => null, + 'resourceconfig' => [ 'provisioningmodelearner' => \auth_plugin_lti::PROVISIONING_MODE_AUTO_ONLY, 'provisioningmodeinstructor' => \auth_plugin_lti::PROVISIONING_MODE_AUTO_ONLY ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => null, ], - 'sync_members_data' => [ + 'syncmembers' => [ // This user is just an instructor but is also the user who is already linked, via the launch above. self::get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [ 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor', @@ -1133,16 +1133,16 @@ final class sync_members_test extends \lti_advantage_testcase { ] ], 'All prompt provisioning, mixed bag of users and roles' => [ - 'legacy_data' => null, - 'resource_config' => [ + 'legacydata' => null, + 'resourceconfig' => [ 'provisioningmodelearner' => \auth_plugin_lti::PROVISIONING_MODE_PROMPT_NEW_EXISTING, 'provisioningmodeinstructor' => \auth_plugin_lti::PROVISIONING_MODE_PROMPT_NEW_EXISTING ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => null, ], - 'sync_members_data' => [ + 'syncmembers' => [ // This user is just an instructor but is also the user who is already linked, via the launch above. self::get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [ 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor', @@ -1183,7 +1183,7 @@ final class sync_members_test extends \lti_advantage_testcase { ] ], 'All automatic provisioning, with legacy data and migration claim, mixed bag of users and roles' => [ - 'legacy_data' => [ + 'legacydata' => [ 'users' => [ ['user_id' => '2'], ['user_id' => '3'], @@ -1196,11 +1196,11 @@ final class sync_members_test extends \lti_advantage_testcase { ['secret' => 'toolsecret2'], ] ], - 'resource_config' => [ + 'resourceconfig' => [ 'provisioningmodelearner' => \auth_plugin_lti::PROVISIONING_MODE_AUTO_ONLY, 'provisioningmodeinstructor' => \auth_plugin_lti::PROVISIONING_MODE_AUTO_ONLY ], - 'launch_data' => [ + 'launchdata' => [ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0], 'launch_migration_claim' => [ 'consumer_key' => 'CONSUMER_1', @@ -1210,7 +1210,7 @@ final class sync_members_test extends \lti_advantage_testcase { 'resource_link_id' => '4b6fa' ], ], - 'sync_members_data' => [ + 'syncmembers' => [ // This user is just an instructor but is also the user who is already linked, via the launch above. self::get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [ 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor', diff --git a/enrol/manual/tests/lib_test.php b/enrol/manual/tests/lib_test.php index 751fdc83898..d9694dbe2bd 100644 --- a/enrol/manual/tests/lib_test.php +++ b/enrol/manual/tests/lib_test.php @@ -603,7 +603,7 @@ final class lib_test extends \advanced_testcase { 'notifyall' => 0, 'expirythreshold' => 12 * HOURSECS, ], - 'global settings' => (object) [ + 'globalsettings' => (object) [ 'status' => ENROL_INSTANCE_ENABLED, 'roleid' => $studentrole->id, 'enrolperiod' => 0, @@ -620,7 +620,7 @@ final class lib_test extends \advanced_testcase { 'notifyall' => 0, 'expirythreshold' => DAYSECS, ], - 'global settings' => (object) [ + 'globalsettings' => (object) [ 'status' => ENROL_INSTANCE_ENABLED, 'roleid' => $studentrole->id, 'enrolperiod' => 72 * HOURSECS, @@ -637,7 +637,7 @@ final class lib_test extends \advanced_testcase { 'notifyall' => 1, 'expirythreshold' => 0 ], - 'global settings' => (object) [ + 'globalsettings' => (object) [ 'status' => ENROL_INSTANCE_DISABLED, 'roleid' => $teacherrole->id, 'enrolperiod' => 0, @@ -717,7 +717,7 @@ final class lib_test extends \advanced_testcase { 'notifyall' => 0, 'expirythreshold' => 2 * DAYSECS, ], - 'update data' => (object) [ + 'updatedata' => (object) [ 'status' => ENROL_INSTANCE_DISABLED, 'roleid' => $studentrole->id, 'enrolperiod' => 30 * DAYSECS, @@ -734,7 +734,7 @@ final class lib_test extends \advanced_testcase { 'notifyall' => 0, 'expirythreshold' => 0, ], - 'update data' => (object) [ + 'updatedata' => (object) [ 'status' => ENROL_INSTANCE_ENABLED, 'roleid' => $teacherrole->id, 'enrolperiod' => 0, @@ -751,7 +751,7 @@ final class lib_test extends \advanced_testcase { 'notifyall' => 1, 'expirythreshold' => 2 * DAYSECS, ], - 'update data' => (object) [ + 'updatedata' => (object) [ 'status' => ENROL_INSTANCE_ENABLED, 'roleid' => $studentrole->id, 'enrolperiod' => 30 * DAYSECS, diff --git a/enrol/tests/enrollib_test.php b/enrol/tests/enrollib_test.php index ef5e48ee725..c7c39af7a41 100644 --- a/enrol/tests/enrollib_test.php +++ b/enrol/tests/enrollib_test.php @@ -386,7 +386,7 @@ final class enrollib_test extends advanced_testcase { 'The teacher can un-enrol users in a course' => [ 'excludedcapabilities' => [], - 'results' => [ + 'expected' => [ // Whether certain enrolment related data still exists in the course after the deletion. // When the user has the capabilities to un-enrol users and the enrolment plugins allow manual // unenerolment than all course enrolment data should be removed. @@ -406,7 +406,7 @@ final class enrollib_test extends advanced_testcase { // Exclude the following capabilities for the editing teacher. 'enrol/self:unenrol' ], - 'results' => [ + 'expected' => [ // When the user does not have the capabilities to un-enrol self enrolled users, the data // related to this enrolment method should not be removed. Everything else should be removed. 'Manual course enrolment instance exists' => false, @@ -426,7 +426,7 @@ final class enrollib_test extends advanced_testcase { 'enrol/manual:unenrol', 'enrol/self:unenrol' ], - 'results' => [ + 'expected' => [ // When the user does not have the capabilities to un-enrol self and manually enrolled users, // the data related to these enrolment methods should not be removed. 'Manual course enrolment instance exists' => true, diff --git a/grade/tests/grades/grader/gradingpanel/point/external/store_test.php b/grade/tests/grades/grader/gradingpanel/point/external/store_test.php index eb9fdea8446..61774cd099a 100644 --- a/grade/tests/grades/grader/gradingpanel/point/external/store_test.php +++ b/grade/tests/grades/grader/gradingpanel/point/external/store_test.php @@ -296,20 +296,20 @@ final class store_test extends advanced_testcase { public static function execute_out_of_range_provider(): array { return [ 'above' => [ - 'max' => 100, - 'supplied' => 101, + 'maxvalue' => 100, + 'suppliedvalue' => 101, ], 'above just' => [ - 'max' => 100, - 'supplied' => 101.001, + 'maxvalue' => 100, + 'suppliedvalue' => 101.001, ], 'below' => [ - 'max' => 100, - 'supplied' => -100, + 'maxvalue' => 100, + 'suppliedvalue' => -100, ], '-1' => [ - 'max' => 100, - 'supplied' => -1, + 'maxvalue' => 100, + 'suppliedvalue' => -1, ], ]; } diff --git a/grade/tests/grades/grader/gradingpanel/scale/external/store_test.php b/grade/tests/grades/grader/gradingpanel/scale/external/store_test.php index b7c1677cedf..3cf195727dd 100644 --- a/grade/tests/grades/grader/gradingpanel/scale/external/store_test.php +++ b/grade/tests/grades/grader/gradingpanel/scale/external/store_test.php @@ -401,16 +401,16 @@ final class store_test extends advanced_testcase { public static function execute_out_of_range_provider(): array { return [ 'above' => [ - 'supplied' => 500, + 'suppliedvalue' => 500, ], 'above just' => [ - 'supplied' => 4, + 'suppliedvalue' => 4, ], 'below' => [ - 'supplied' => -100, + 'suppliedvalue' => -100, ], '-10' => [ - 'supplied' => -10, + 'suppliedvalue' => -10, ], ]; } diff --git a/grade/tests/lib_test.php b/grade/tests/lib_test.php index 1933f9a942a..9a9378f4561 100644 --- a/grade/tests/lib_test.php +++ b/grade/tests/lib_test.php @@ -461,13 +461,13 @@ final class lib_test extends \advanced_testcase { return [ 'nohidden' => [ 'hidden' => false, - 'count' => ['course' => 1, 'Grade item1' => 1], - 'sumarray' => ['course' => 6.00000, 'Grade item1' => 3.00000], + 'expectedcount' => ['course' => 1, 'Grade item1' => 1], + 'expectedsumarray' => ['course' => 6.00000, 'Grade item1' => 3.00000], ], 'includehidden' => [ 'hidden' => true, - 'count' => ['course' => 1, 'Grade item1' => 2], - 'sumarray' => ['course' => 6.00000, 'Grade item1' => 6.00000], + 'expectedcount' => ['course' => 1, 'Grade item1' => 2], + 'expectedsumarray' => ['course' => 6.00000, 'Grade item1' => 6.00000], ], ]; } @@ -736,50 +736,50 @@ final class lib_test extends \advanced_testcase { 'onlyactive' => true, 'hascapability' => 1, 'showonlyactiveenrolpref' => null, - 'count' => ['course' => 1, 'Grade item1' => 1], - 'sumarray' => ['course' => 1, 'Grade item1' => 1.00000], + 'expectedcount' => ['course' => 1, 'Grade item1' => 1], + 'expectedsumarray' => ['course' => 1, 'Grade item1' => 1.00000], ], 'Show only active and user preference set to true' => [ 'onlyactive' => true, 'hascapability' => 1, 'showonlyactiveenrolpref' => true, - 'count' => ['course' => 1, 'Grade item1' => 1], - 'sumarray' => ['course' => 1, 'Grade item1' => 1.00000], + 'expectedcount' => ['course' => 1, 'Grade item1' => 1], + 'expectedsumarray' => ['course' => 1, 'Grade item1' => 1.00000], ], 'Show only active and user preference set to false' => [ 'onlyactive' => true, 'hascapability' => 1, 'showonlyactiveenrolpref' => false, - 'count' => ['course' => 1, 'Grade item1' => 1], - 'sumarray' => ['course' => 3.00000, 'Grade item1' => 3.00000], + 'expectedcount' => ['course' => 1, 'Grade item1' => 1], + 'expectedsumarray' => ['course' => 3.00000, 'Grade item1' => 3.00000], ], 'Include suspended with capability and user preference set to true' => [ 'onlyactive' => false, 'hascapability' => 1, 'showonlyactiveenrolpref' => true, - 'count' => ['course' => 1, 'Grade item1' => 1], - 'sumarray' => ['course' => 1.00000, 'Grade item1' => 1.00000], + 'expectedcount' => ['course' => 1, 'Grade item1' => 1], + 'expectedsumarray' => ['course' => 1.00000, 'Grade item1' => 1.00000], ], 'Include suspended with capability and user preference set to false' => [ 'onlyactive' => false, 'hascapability' => 1, 'showonlyactiveenrolpref' => false, - 'count' => ['course' => 1, 'Grade item1' => 1], - 'sumarray' => ['course' => 3.00000, 'Grade item1' => 3.00000], + 'expectedcount' => ['course' => 1, 'Grade item1' => 1], + 'expectedsumarray' => ['course' => 3.00000, 'Grade item1' => 3.00000], ], 'Include suspended with capability and no user preference' => [ 'onlyactive' => false, 'hascapability' => 1, 'showonlyactiveenrolpref' => null, - 'count' => ['course' => 1, 'Grade item1' => 1], - 'sumarray' => ['course' => 3.00000, 'Grade item1' => 3.00000], + 'expectedcount' => ['course' => 1, 'Grade item1' => 1], + 'expectedsumarray' => ['course' => 3.00000, 'Grade item1' => 3.00000], ], 'Include suspended without capability' => [ 'onlyactive' => false, 'hascapability' => -1, 'showonlyactiveenrolpref' => null, - 'count' => ['course' => 1, 'Grade item1' => 1], - 'sumarray' => ['course' => 1.00000, 'Grade item1' => 1.00000], + 'expectedcount' => ['course' => 1, 'Grade item1' => 1], + 'expectedsumarray' => ['course' => 1.00000, 'Grade item1' => 1.00000], ], ]; } diff --git a/h5p/tests/editor_framework_test.php b/h5p/tests/editor_framework_test.php index 988d16b378d..0d02ebad500 100644 --- a/h5p/tests/editor_framework_test.php +++ b/h5p/tests/editor_framework_test.php @@ -136,7 +136,8 @@ final class editor_framework_test extends \advanced_testcase { 2, ], 'One library created but getting translation from an unexisting one' => [ - 'Library1 1.2' => [ + // Library1 1.2. + [ 'machinename' => 'Library1', 'title' => 'Lib1', 'majorversion' => 1, @@ -151,7 +152,8 @@ final class editor_framework_test extends \advanced_testcase { 'AnotherLibrary', ], 'One library without any translation' => [ - 'Library1 1.2' => [ + // Library1 1.2. + [ 'machinename' => 'Library1', 'title' => 'Lib1', 'majorversion' => 1, @@ -161,7 +163,8 @@ final class editor_framework_test extends \advanced_testcase { true, ], 'One library with 2 translations (es and fr) - es' => [ - 'Library1 1.2' => [ + // Library1 1.2. + [ 'machinename' => 'Library1', 'title' => 'Lib1', 'majorversion' => 1, @@ -174,7 +177,8 @@ final class editor_framework_test extends \advanced_testcase { 'es', ], 'One library with 2 translations (es and fr) - fr' => [ - 'Library1 1.2' => [ + // Library1 1.2. + [ 'machinename' => 'Library1', 'title' => 'Lib1', 'majorversion' => 1, @@ -187,7 +191,8 @@ final class editor_framework_test extends \advanced_testcase { 'fr', ], 'One library with 2 translations (es and fr) - unexisting translation (de)' => [ - 'Library1 1.2' => [ + // Library1 1.2. + [ 'machinename' => 'Library1', 'title' => 'Lib1', 'majorversion' => 1, @@ -201,7 +206,8 @@ final class editor_framework_test extends \advanced_testcase { true ], 'One library with 3 translations (one of them English) - fr' => [ - 'Library1 1.2' => [ + // Library1 1.2. + [ 'machinename' => 'Library1', 'title' => 'Lib1', 'majorversion' => 1, @@ -215,7 +221,8 @@ final class editor_framework_test extends \advanced_testcase { 'fr', ], 'One library with 3 translations (one of them English) - en' => [ - 'Library1 1.2' => [ + // Library1 1.2. + [ 'machinename' => 'Library1', 'title' => 'Lib1', 'majorversion' => 1, @@ -299,7 +306,8 @@ final class editor_framework_test extends \advanced_testcase { 2, ], 'One library created but getting available from an unexisting one' => [ - 'Library1 1.2' => [ + // Library1 1.2. + [ 'machinename' => 'Library1', 'title' => 'Lib1', 'majorversion' => 1, @@ -315,7 +323,8 @@ final class editor_framework_test extends \advanced_testcase { 2, ], 'One library without any translation' => [ - 'Library1 1.2' => [ + // Library1 1.2. + [ 'machinename' => 'Library1', 'title' => 'Lib1', 'majorversion' => 1, @@ -324,7 +333,8 @@ final class editor_framework_test extends \advanced_testcase { ['en'], ], 'One library with 2 translations (es and fr)' => [ - 'Library1 1.2' => [ + // Library1 1.2. + [ 'machinename' => 'Library1', 'title' => 'Lib1', 'majorversion' => 1, @@ -337,7 +347,8 @@ final class editor_framework_test extends \advanced_testcase { ['en', 'es', 'fr'], ], 'One library with 3 translations (one of them English)' => [ - 'Library1 1.2' => [ + // Library1 1.2. + [ 'machinename' => 'Library1', 'title' => 'Lib1', 'majorversion' => 1, diff --git a/lib/classes/date.php b/lib/classes/date.php index 453faa133ae..4c029aa5ffa 100644 --- a/lib/classes/date.php +++ b/lib/classes/date.php @@ -153,7 +153,7 @@ class core_date { // Is server timezone usable? if (isset($CFG->timezone) and !is_numeric($CFG->timezone)) { - $result = @timezone_open($CFG->timezone); // Hide notices if invalid. + $result = timezone_open($CFG->timezone); // Hide notices if invalid. if ($result !== false) { return $result->getName(); } @@ -319,7 +319,7 @@ class core_date { if (!defined('PHPUNIT_TEST')) { throw new coding_exception('core_date::phpunit_override_default_php_timezone() must be used only from unit tests'); } - $result = timezone_open($tz ?? ''); // This triggers error if $tz invalid. + $result = @timezone_open($tz ?? ''); // This triggers error if $tz invalid. if ($result !== false) { self::$defaultphptimezone = $tz; } else { diff --git a/lib/classes/lock/lock.php b/lib/classes/lock/lock.php index f17abdaf4d1..44f78f60be6 100644 --- a/lib/classes/lock/lock.php +++ b/lib/classes/lock/lock.php @@ -106,19 +106,35 @@ class lock { } /** - * Print debugging if this lock falls out of scope before being released. + * Release a lock if it has not already been released. + * + * @param bool $withexception If true, throw an exception if the lock has not been released. + * @throws \coding_exception */ - public function __destruct() { - if (!$this->released && defined('PHPUNIT_TEST')) { + public function release_if_not_released(bool $withexception = false): void { + if (!$this->released) { $key = $this->key; + $this->release(); - throw new \coding_exception("A lock was created but not released at:\n" . - $this->caller . "\n\n" . - " Code should look like:\n\n" . - " \$factory = \core\lock\lock_config::get_lock_factory('type');\n" . - " \$lock = \$factory->get_lock($key);\n" . - " \$lock->release(); // Locks must ALWAYS be released like this.\n\n"); + + if ($withexception) { + throw new \core\exception\coding_exception(<<caller} + + Code should look like: + + \$factory = \core\lock\lock_config::get_lock_factory('type'); + \$lock = \$factory->get_lock($key); + \$lock->release(); // Locks must ALWAYS be released like this. + EOF); + } } } + /** + * Print debugging if this lock falls out of scope before being released. + */ + public function __destruct() { + $this->release_if_not_released(defined('PHPUNIT_TEST')); + } } diff --git a/lib/dml/tests/dml_pgsql_read_replica_test.php b/lib/dml/tests/dml_pgsql_read_replica_test.php index d57b0535c99..a265ebe7da1 100644 --- a/lib/dml/tests/dml_pgsql_read_replica_test.php +++ b/lib/dml/tests/dml_pgsql_read_replica_test.php @@ -280,6 +280,9 @@ final class dml_pgsql_read_replica_test extends \advanced_testcase { ]; $this->resetDebugging(); + set_error_handler(function ($errno, $errstr) { + $this->assertStringContainsString('could not connect to server', $errstr); + }, E_ALL); $db2 = moodle_database::get_driver_instance($cfg->dbtype, $cfg->dblibrary); $db2->connect($cfg->dbhost, $cfg->dbuser, $cfg->dbpass, $cfg->dbname, $cfg->prefix, $cfg->dboptions); $this->assertNotEmpty($db2->get_records('user')); @@ -301,5 +304,7 @@ final class dml_pgsql_read_replica_test extends \advanced_testcase { ); // Attempt to connect to the existing DB host will succeed. $this->assertEquals("Readwrite db connection succeeded for host {$cfg->dbhost}", $debugging[1]); + $this->assertTrue(count($db2->get_records('user')) > 0); + restore_error_handler(); } } diff --git a/lib/dml/tests/dml_table_test.php b/lib/dml/tests/dml_table_test.php index 432db425fbe..f1ccbea5d39 100644 --- a/lib/dml/tests/dml_table_test.php +++ b/lib/dml/tests/dml_table_test.php @@ -45,7 +45,7 @@ final class dml_table_test extends \database_driver_testcase { 'primarykey' => 'id', 'fieldprefix' => 'ban', 'tablealias' => 'banana', - 'banana.id AS banid', + 'expected' => 'banana.id AS banid', ], 'multiple fields' => [ 'tablename' => 'test_table_multiple', @@ -57,7 +57,7 @@ final class dml_table_test extends \database_driver_testcase { 'primarykey' => 'id', 'fieldprefix' => 'ban', 'tablealias' => 'banana', - 'banana.id AS banid, banana.course AS bancourse, banana.name AS banname', + 'expected' => 'banana.id AS banid, banana.course AS bancourse, banana.name AS banname', ], ]; } @@ -111,13 +111,13 @@ final class dml_table_test extends \database_driver_testcase { 'flag' => ['flag', XMLDB_TYPE_CHAR, '255', null, null, null, 'lala'], ], 'primarykey' => 'id', - 'prefix' => 's', + 'fieldprefix' => 's', 'result' => (object) [ 'sid' => 1, 'scourse' => 42, 'sflag' => 'foo', ], - 'expectedrecord' => (object) [ + 'expected' => (object) [ 'id' => 1, 'course' => 42, 'flag' => 'foo', @@ -130,7 +130,7 @@ final class dml_table_test extends \database_driver_testcase { 'flag' => ['flag', XMLDB_TYPE_CHAR, '255', null, null, null, 'lala'], ], 'primarykey' => 'id', - 'prefix' => 's', + 'fieldprefix' => 's', 'result' => (object) [ 'sid' => 1, 'scourse' => 42, @@ -139,7 +139,7 @@ final class dml_table_test extends \database_driver_testcase { 'ocourse' => 'course', 'oflag' => 'flag', ], - 'expectedrecord' => (object) [ + 'expected' => (object) [ 'id' => 1, 'course' => 42, 'flag' => 'foo', diff --git a/lib/dml/tests/dml_test.php b/lib/dml/tests/dml_test.php index d3f367817f0..7ee6dc0a8d7 100644 --- a/lib/dml/tests/dml_test.php +++ b/lib/dml/tests/dml_test.php @@ -487,7 +487,8 @@ final class dml_test extends \database_driver_testcase { $DB = $this->tdb; require_once($CFG->dirroot . '/lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php'); - $fixture = new \test_dml_sql_debugging_fixture($this); + $databasemock = $this->getMockBuilder(\moodle_database::class)->getMock(); + $fixture = new \test_dml_sql_debugging_fixture($databasemock); $sql = "SELECT * FROM {users}"; @@ -499,31 +500,31 @@ final class dml_test extends \database_driver_testcase { $CFG->debugsqltrace = 1; $out = $fixture->four($sql); $expected = <<invoke() +SELECT \* FROM {users} +-- line \d+ of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to ReflectionMethod->invoke\(\) EOD; - $this->assertEquals($this->unix_to_os_dirsep($expected), $out); + $this->assertMatchesRegularExpression('@' . $this->unix_to_os_dirsep($expected) . '@', $out); $CFG->debugsqltrace = 2; $out = $fixture->four($sql); $expected = <<invoke() --- line 73 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->one() +SELECT \* FROM {users} +-- line \d+ of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to ReflectionMethod->invoke\(\) +-- line \d+ of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->one\(\) EOD; - $this->assertEquals($this->unix_to_os_dirsep($expected), $out); + $this->assertMatchesRegularExpression('@' . $this->unix_to_os_dirsep($expected) . '@', $out); $CFG->debugsqltrace = 5; $out = $fixture->four($sql); $expected = <<invoke() --- line 73 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->one() --- line 82 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->two() --- line 91 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->three() --- line 517 of /lib/dml/tests/dml_test.php: call to test_dml_sql_debugging_fixture->four() +SELECT \* FROM {users} +-- line \d+ of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to ReflectionMethod->invoke\(\) +-- line \d+ of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->one\(\) +-- line \d+ of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->two\(\) +-- line \d+ of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->three\(\) +-- line \d+ of /lib/dml/tests/dml_test.php: call to test_dml_sql_debugging_fixture->four\(\) EOD; - $this->assertEquals($this->unix_to_os_dirsep($expected), $out); + $this->assertMatchesRegularExpression('@' . $this->unix_to_os_dirsep($expected) . '@', $out); $CFG->debugsqltrace = 0; } @@ -4523,7 +4524,7 @@ EOD; 'name' => 'Bob', 'falias' => 'Dan, Grace', ], - ], $DB->get_records_sql($sql)); + ], array_values($DB->get_records_sql($sql))); } /** diff --git a/lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php b/lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php index c29268c0e09..955677b132a 100644 --- a/lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php +++ b/lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php @@ -34,16 +34,14 @@ defined('MOODLE_INTERNAL') || die(); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class test_dml_sql_debugging_fixture { - /** @var db handle */ - private $db; - /** - * constructor - * @param testcase $testcase test object + * Constructor + * @param \moodle_database $db The database handle to use for this fixture */ - public function __construct($testcase) { - $this->db = $testcase->getMockBuilder(\moodle_database::class) - ->getMockForAbstractClass(); + public function __construct( + /** @var \moodle_database The database handle to use for this fixture */ + private \moodle_database $db, + ) { } /** diff --git a/lib/dml/tests/pgsql_native_moodle_database_test.php b/lib/dml/tests/pgsql_native_moodle_database_test.php index f570f80aee2..c440e2d1263 100644 --- a/lib/dml/tests/pgsql_native_moodle_database_test.php +++ b/lib/dml/tests/pgsql_native_moodle_database_test.php @@ -29,6 +29,7 @@ use stdClass, ReflectionClass; use moodle_database, pgsql_native_moodle_database; use xmldb_table; use moodle_exception; +use PHPUnit\Framework\Attributes\WithoutErrorHandler; /** * Test specific features of the Postgres dml. @@ -396,6 +397,7 @@ final class pgsql_native_moodle_database_test extends \advanced_testcase { /** * Test SSL connection. */ + #[WithoutErrorHandler] public function test_ssl_connection(): void { $pgconnerr = 'pg_connect(): Unable to connect to PostgreSQL server:'; diff --git a/lib/filestorage/tests/file_system_filedir_test.php b/lib/filestorage/tests/file_system_filedir_test.php index c03725c68d9..17f44190602 100644 --- a/lib/filestorage/tests/file_system_filedir_test.php +++ b/lib/filestorage/tests/file_system_filedir_test.php @@ -1098,12 +1098,12 @@ final class file_system_filedir_test extends \advanced_testcase { public static function contenthash_dataprovider(): array { return array( array( - 'contenthash' => 'eee4943847a35a4b6942c6f96daafde06bcfdfab', - 'contentdir' => 'ee/e4', + 'hash' => 'eee4943847a35a4b6942c6f96daafde06bcfdfab', + 'hashdir' => 'ee/e4', ), array( - 'contenthash' => 'aef05a62ae81ca0005d2569447779af062b7cda0', - 'contentdir' => 'ae/f0', + 'hash' => 'aef05a62ae81ca0005d2569447779af062b7cda0', + 'hashdir' => 'ae/f0', ), ); } diff --git a/lib/filestorage/tests/zip_packer_test.php b/lib/filestorage/tests/zip_packer_test.php index cbc0ee59c32..9bece8adc6a 100644 --- a/lib/filestorage/tests/zip_packer_test.php +++ b/lib/filestorage/tests/zip_packer_test.php @@ -536,24 +536,14 @@ final class zip_packer_test extends \advanced_testcase implements file_progress unlink($textfile); // Behavior is different between old PHP versions and new ones. Let's detect it. $result = false; - try { - // Old PHP versions were not printing any warning. - $result = $zip_archive->close(); - } catch (\Exception $e) { - // New PHP versions print PHP Warning. - $this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e); - $this->assertStringContainsString('ZipArchive::close', $e->getMessage()); - } - // This is crazy, but it shows how some PHP versions do return true. - try { - // And some PHP versions do return correctly false (5.4.25, 5.6.14...) - $this->assertFalse($result); - } catch (\Exception $e) { - // But others do insist into returning true (5.6.13...). Only can accept them. - $this->assertInstanceOf('PHPUnit\Framework\ExpectationFailedException', $e); - $this->assertTrue($result); - } + + set_error_handler(function ($errno, $errstr) use (&$result) { + $result = $errstr; + $this->assertStringContainsString('ZipArchive::close', $errstr); + }, E_WARNING); + $this->assertFalse($zip_archive->close()); $this->assertFileDoesNotExist($archive); + restore_error_handler(); } /** diff --git a/lib/phpunit/classes/advanced_testcase.php b/lib/phpunit/classes/advanced_testcase.php index 85295015477..351e2f195d1 100644 --- a/lib/phpunit/classes/advanced_testcase.php +++ b/lib/phpunit/classes/advanced_testcase.php @@ -20,6 +20,8 @@ use core\http_client; use GuzzleHttp\Handler\MockHandler; use GuzzleHttp\HandlerStack; use GuzzleHttp\Middleware; +use PHPUnit\Framework\Attributes\After; +use PHPUnit\Framework\Attributes\Before; /** * Advanced PHPUnit test case customised for Moodle. @@ -46,21 +48,16 @@ abstract class advanced_testcase extends base_testcase { * Note: use setUp() or setUpBeforeClass() in your test cases. * * @param string $name - * @param array $data - * @param string $dataName */ - final public function __construct($name = null, array $data = [], $dataname = '') { - parent::__construct($name, $data, $dataname); + final public function __construct(string $name) { + parent::__construct($name); $this->setBackupGlobals(false); - $this->setBackupStaticAttributes(false); $this->setPreserveGlobalState(false); } - /** - * Runs the bare test sequence. - */ - final public function runBare(): void { + #[Before] + final public function setup_test_environment(): void { global $CFG, $DB; if (phpunit_util::$lastdbwrites != $DB->perf_get_writes()) { @@ -71,28 +68,18 @@ abstract class advanced_testcase extends base_testcase { $this->testdbtransaction = $DB->start_delegated_transaction(); } - try { - $this->setCurrentTimeStart(); - parent::runBare(); - } catch (Exception $ex) { - $e = $ex; - } catch (Throwable $ex) { - // Engine errors in PHP7 throw exceptions of type Throwable (this "catch" will be ignored in PHP5). - $e = $ex; - } finally { - // Reset global state after test and test failure. - $CFG = phpunit_util::get_global_backup('CFG'); - $DB = phpunit_util::get_global_backup('DB'); + $this->setCurrentTimeStart(); + } - // We need to reset the autoloader. - \core_component::reset(); - } + #[After] + final public function teardown_test_environment(): void { + global $CFG, $DB; + // Reset global state after test and test failure. + $CFG = phpunit_util::get_global_backup('CFG'); + $DB = phpunit_util::get_global_backup('DB'); - if (isset($e)) { - // Cleanup after failed expectation. - self::resetAllData(); - throw $e; - } + // We need to reset the autoloader. + \core_component::reset(); // Deal with any debugging messages. $debugerror = phpunit_util::display_debugging_messages(true); @@ -698,8 +685,8 @@ abstract class advanced_testcase extends base_testcase { $params['userid'] = $matchuserid; } - $lock = $this->createMock(\core\lock\lock::class); - $cronlock = $this->createMock(\core\lock\lock::class); + $lock = $this->createStub(\core\lock\lock::class); + $cronlock = $this->createStub(\core\lock\lock::class); $tasks = $DB->get_recordset('task_adhoc', $params); foreach ($tasks as $record) { diff --git a/lib/phpunit/classes/base_testcase.php b/lib/phpunit/classes/base_testcase.php index 4145f4ad62e..d28ea05f43f 100644 --- a/lib/phpunit/classes/base_testcase.php +++ b/lib/phpunit/classes/base_testcase.php @@ -1,5 +1,4 @@ load($actual, $ishtml); + if ($ishtml) { + $dom = self::loadHTML($actual); + } else { + $dom = (new PHPUnit\Util\Xml\Loader)->load($actual); + } $tags = self::findNodes($dom, $matcher, $ishtml); $matched = (is_array($tags) && count($tags) > 0) && $tags[0] instanceof DOMNode; self::assertTrue($matched, $message); } + /** + * Load HTML into a DomDocument. + * + * Note: THis is a replacement for functionality removed from PHPUnit 10. + * + * @param string $actual + * @throws \PHPUnit\Util\Xml\XmlException + * @return DOMDocument + */ + public static function loadHTML(string $actual): DOMDocument { + if ($actual === '') { + throw new \PHPUnit\Util\Xml\XmlException('Could not load XML from empty string'); + } + + $document = new DOMDocument; + $document->preserveWhiteSpace = false; + + $internal = libxml_use_internal_errors(true); + $message = ''; + $reporting = error_reporting(0); + + $loaded = $document->loadHTML($actual); + + foreach (libxml_get_errors() as $error) { + $message .= "\n" . $error->message; + } + + libxml_use_internal_errors($internal); + error_reporting($reporting); + + if ($loaded === false) { + if ($message === '') { + $message = 'Could not load XML for unknown reason'; + } + + throw new \PHPUnit\Util\Xml\XmlException($message); + } + + return $document; + } + /** * Note: we are overriding this method to remove the deprecated error * @see https://tracker.moodle.org/browse/MDL-47129 @@ -72,7 +118,11 @@ abstract class base_testcase extends PHPUnit\Framework\TestCase { * @deprecated 3.0 */ public static function assertNotTag($matcher, $actual, $message = '', $ishtml = true) { - $dom = (new PHPUnit\Util\Xml\Loader)->load($actual, $ishtml); + if ($ishtml) { + $dom = self::loadHTML($actual); + } else { + $dom = (new PHPUnit\Util\Xml\Loader)->load($actual); + } $tags = self::findNodes($dom, $matcher, $ishtml); $matched = (is_array($tags) && count($tags) > 0) && $tags[0] instanceof DOMNode; self::assertFalse($matched, $message); @@ -605,7 +655,56 @@ abstract class base_testcase extends PHPUnit\Framework\TestCase { * @return int */ protected static function getInvocationCount(InvocationOrder $counter): int { + if (method_exists($counter, 'numberOfInvocations')) { + return $counter->numberOfInvocations(); + } + return $counter->getInvocationCount(); } // phpcs:enable + + /** + * Get an invokable object for testing. + * + * This is a helper method to create an invokable object for testing which can be used to + * track invocations, including arguments provided. + * + * This can be useful for modifications to the error handler. + * + * @return object + */ + protected static function get_invokable() { + return new class { + private array $invocations = []; + public function __invoke(...$args) { + $this->invocations[] = $args; + } + + public function get_invocations(): array { + return $this->invocations; + } + + public function get_invocation_count(): int { + return count($this->invocations); + } + + public function reset(): void { + $this->invocations = []; + } + }; + } + + /** + * Determine whether the test is running in isolation. + * + * Note: This was previously a public method of the TestCase, but as removed in PHPUnit 10. + * There is no direct replacement, but we can use reflection to access the protected property. + * @return bool + */ + public function isInIsolation(): bool { + $rc = new \ReflectionClass(TestCase::class); + $rcp = $rc->getProperty('inIsolation'); + + return $rcp->getValue($this); + } } diff --git a/lib/phpunit/classes/basic_testcase.php b/lib/phpunit/classes/basic_testcase.php index 497f260bd90..0abdb3fc005 100644 --- a/lib/phpunit/classes/basic_testcase.php +++ b/lib/phpunit/classes/basic_testcase.php @@ -1,4 +1,5 @@ . -/** - * Basic test case. - * - * @package core - * @category phpunit - * @copyright 2012 Petr Skoda {@link http://skodak.org} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - - /** * The simplest PHPUnit test case customised for Moodle * @@ -35,52 +26,38 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class basic_testcase extends base_testcase { - /** * Constructs a test case with the given name. * - * Note: use setUp() or setUpBeforeClass() in your test cases. * * @param string $name - * @param array $data - * @param string $dataName */ - final public function __construct($name = null, array $data = array(), $dataName = '') { - parent::__construct($name, $data, $dataName); + final public function __construct($name = null) { + parent::__construct($name); $this->setBackupGlobals(false); - $this->setBackupStaticAttributes(false); $this->setRunTestInSeparateProcess(false); } - /** - * Runs the bare test sequence and log any changes in global state or database. - * @return void - */ - final public function runBare(): void { + #[After] + final public function test_teardown(): void { global $DB; - try { - parent::runBare(); - - } catch (Exception $ex) { - $e = $ex; - } catch (Throwable $ex) { - // Engine errors in PHP7 throw exceptions of type Throwable (this "catch" will be ignored in PHP5). - $e = $ex; - } - - if (isset($e)) { - // cleanup after failed expectation - phpunit_util::reset_all_data(); - throw $e; - } - if ($DB->is_transaction_started()) { phpunit_util::reset_all_data(); - throw new coding_exception('basic_testcase '.$this->getName().' is not supposed to use database transactions!'); + throw new coding_exception('basic_testcase ' . $this->getName() . ' is not supposed to use database transactions!'); } phpunit_util::reset_all_data(true); } + + /** + * Get the name of the test. + * + * Replaces the original PHPUnit method. + * @return string + */ + final public function getName(): string { + return $this->name(); + } } diff --git a/lib/phpunit/classes/database_driver_testcase.php b/lib/phpunit/classes/database_driver_testcase.php index 06e1c83eedb..8c18de5eef9 100644 --- a/lib/phpunit/classes/database_driver_testcase.php +++ b/lib/phpunit/classes/database_driver_testcase.php @@ -1,4 +1,6 @@ setBackupGlobals(false); - $this->setBackupStaticAttributes(false); $this->setRunTestInSeparateProcess(false); } @@ -100,9 +99,9 @@ abstract class database_driver_testcase extends base_testcase { self::$extradb = $d; } - protected function setUp(): void { + #[Before] + protected function setup_extradb(): void { global $DB; - parent::setUp(); if (self::$extradb) { $this->tdb = self::$extradb; @@ -111,7 +110,8 @@ abstract class database_driver_testcase extends base_testcase { } } - protected function tearDown(): void { + #[After] + protected function teardown_extradb(): void { // delete all test tables $dbman = $this->tdb->get_manager(); $tables = $this->tdb->get_tables(false); @@ -121,7 +121,6 @@ abstract class database_driver_testcase extends base_testcase { $dbman->drop_table($table); } } - parent::tearDown(); } public static function tearDownAfterClass(): void { @@ -133,34 +132,13 @@ abstract class database_driver_testcase extends base_testcase { parent::tearDownAfterClass(); } - /** - * Runs the bare test sequence. - * @return void - */ - public function runBare(): void { - try { - parent::runBare(); - - // Deal with any debugging messages. - $debugerror = phpunit_util::display_debugging_messages(true); - $this->resetDebugging(); - if (!empty($debugerror)) { - trigger_error('Unexpected debugging() call detected.' . "\n" . $debugerror, E_USER_NOTICE); - } - - } catch (Exception $ex) { - $e = $ex; - } catch (Throwable $ex) { - // Engine errors in PHP7 throw exceptions of type Throwable (this "catch" will be ignored in PHP5). - $e = $ex; - } - - if (isset($e)) { - if ($this->tdb->is_transaction_started()) { - $this->tdb->force_transaction_rollback(); - } - $this->tearDown(); - throw $e; + #[After] + public function check_debugging(): void { + // Deal with any debugging messages. + $debugerror = phpunit_util::display_debugging_messages(true); + $this->resetDebugging(); + if (!empty($debugerror)) { + trigger_error('Unexpected debugging() call detected.' . "\n" . $debugerror, E_USER_NOTICE); } } diff --git a/lib/phpunit/classes/exception/test_exception.php b/lib/phpunit/classes/exception/test_exception.php new file mode 100644 index 00000000000..c9257bd33b7 --- /dev/null +++ b/lib/phpunit/classes/exception/test_exception.php @@ -0,0 +1,27 @@ +. + +namespace core_phpunit\exception; + +/** + * An exception thrown when an error is encountered in the setup, teardown, or other non-test parts of a unit test. + * + * @package core_testing + * @copyright Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class test_exception extends \core\exception\coding_exception { +} diff --git a/lib/phpunit/classes/util.php b/lib/phpunit/classes/util.php index 1ad2fde17a6..765aae2dff3 100644 --- a/lib/phpunit/classes/util.php +++ b/lib/phpunit/classes/util.php @@ -314,7 +314,7 @@ class phpunit_util extends testing_util { if ($warnings) { $warnings = implode("\n", $warnings); - trigger_error($warnings, E_USER_WARNING); + throw new \core_phpunit\exception\test_exception($warnings); } } diff --git a/lib/phpunit/phpunit.xsd b/lib/phpunit/phpunit.xsd index 3785d21fef7..480d54decab 100644 --- a/lib/phpunit/phpunit.xsd +++ b/lib/phpunit/phpunit.xsd @@ -2,7 +2,7 @@ - This Schema file defines the rules by which the XML configuration file of PHPUnit 9.5 may be structured. + This Schema file defines the rules by which the XML configuration file of PHPUnit 10.0 may be structured. @@ -32,7 +32,6 @@ - @@ -57,62 +56,19 @@ - + - + - - - - - - - - - - + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -135,7 +91,7 @@ - + @@ -207,19 +163,14 @@ - + + - - - - - - - + @@ -235,37 +186,36 @@ - - + - - - - + - + + + + + + - - @@ -279,8 +229,10 @@ - - + + + + @@ -301,8 +253,6 @@ - - @@ -319,6 +269,12 @@ + + + + + + diff --git a/lib/phpunit/tests/advanced_test.php b/lib/phpunit/tests/advanced_test.php index 69826145452..fecdfe3dbbb 100644 --- a/lib/phpunit/tests/advanced_test.php +++ b/lib/phpunit/tests/advanced_test.php @@ -16,6 +16,8 @@ namespace core; +use core_phpunit\exception\test_exception; + /** * Test advanced_testcase extra features. * @@ -216,28 +218,29 @@ final class advanced_test extends \advanced_testcase { // Database change. $this->assertEquals(1, $DB->get_field('user', 'confirmed', array('id'=>2))); $DB->set_field('user', 'confirmed', 0, array('id'=>2)); + try { self::resetAllData(true); - } catch (\Exception $e) { - $this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e); + } catch (test_exception $e) { + $this->assertStringContainsString('unexpected database modification', $e->getMessage()); } - $this->assertEquals(1, $DB->get_field('user', 'confirmed', array('id'=>2))); + $this->assertEquals(1, $DB->get_field('user', 'confirmed', array('id'=>2))); // Config change. $CFG->xx = 'yy'; unset($CFG->admin); $CFG->rolesactive = 0; + try { self::resetAllData(true); - } catch (\Exception $e) { - $this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e); + } catch (test_exception $e) { $this->assertStringContainsString('xx', $e->getMessage()); $this->assertStringContainsString('admin', $e->getMessage()); $this->assertStringContainsString('rolesactive', $e->getMessage()); + $this->assertFalse(isset($CFG->xx)); + $this->assertTrue(isset($CFG->admin)); + $this->assertEquals(1, $CFG->rolesactive); } - $this->assertFalse(isset($CFG->xx)); - $this->assertTrue(isset($CFG->admin)); - $this->assertEquals(1, $CFG->rolesactive); // _GET change. $_GET['__somethingthatwillnotnormallybepresent__'] = 'yy'; @@ -269,23 +272,28 @@ final class advanced_test extends \advanced_testcase { $SITE->id = 10; $COURSE = new \stdClass(); $COURSE->id = 7; + try { self::resetAllData(true); - } catch (\Exception $e) { - $this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e); - $this->assertEquals(1, $SITE->id); - $this->assertSame($SITE, $COURSE); - $this->assertSame($SITE, $COURSE); + } catch (test_exception $e) { + $this->assertStringContainsString('unexpected change of $COURSE', $e->getMessage()); } + $this->assertEquals(1, $SITE->id); + $this->assertSame($SITE, $COURSE); + $this->assertSame($SITE, $COURSE); + // USER change. $this->setUser(2); + try { self::resetAllData(true); - } catch (\Exception $e) { - $this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e); - $this->assertEquals(0, $USER->id); + } catch (test_exception $e) { + $this->assertStringContainsString('unexpected change of $USER', $e->getMessage()); } + + $this->assertEquals(0, $USER->id); + } public function test_getDataGenerator(): void { @@ -666,8 +674,8 @@ final class advanced_test extends \advanced_testcase { try { self::resetAllData(true); - } catch (\Exception $e) { - $this->assertInstanceOf('PHPUnit\Framework\Error\Warning', $e); + } catch (test_exception $e) { + $this->assertStringContainsString('unexpected change of locale', $e->getMessage()); } if ($CFG->ostype === 'WINDOWS') { diff --git a/lib/phpunit/tests/basic_test.php b/lib/phpunit/tests/basic_test.php index 0fdb19db168..17fa667bfd0 100644 --- a/lib/phpunit/tests/basic_test.php +++ b/lib/phpunit/tests/basic_test.php @@ -16,6 +16,7 @@ namespace core; +use PHPUnit\Framework\Attributes\WithoutErrorHandler; use phpunit_util; /** @@ -235,16 +236,7 @@ STRING; global $DB; $DB->set_field('user', 'confirmed', 1, ['id' => -1]); - // Let's convert the user warnings into an assert-able exception. - set_error_handler( - static function ($errno, $errstr) { - restore_error_handler(); - throw new \Exception($errstr, $errno); - }, - E_USER_WARNING // Or any other specific E_ that we want to assert. - ); - - $this->expectException(\Exception::class); + $this->expectException(\core_phpunit\exception\test_exception::class); $this->expectExceptionMessage('Warning: unexpected database modification'); phpunit_util::reset_all_data(true); } @@ -261,15 +253,6 @@ STRING; unset($CFG->admin); $CFG->rolesactive = 0; - // Let's convert the user warnings into an assert-able exception. - set_error_handler( - static function ($errno, $errstr) { - restore_error_handler(); - throw new \Exception($errstr, $errno); - }, - E_USER_WARNING // Or any other specific E_ that we want to assert. - ); - $this->expectException(\Exception::class); $this->expectExceptionMessageMatches('/rolesactive.*xx value.*removal.*admin/ms'); // 3 messages matched. phpunit_util::reset_all_data(true); @@ -285,15 +268,6 @@ STRING; global $USER; $USER->id = 10; - // Let's convert the user warnings into an assert-able exception. - set_error_handler( - static function ($errno, $errstr) { - restore_error_handler(); - throw new \Exception($errstr, $errno); - }, - E_USER_WARNING // Or any other specific E_ that we want to assert. - ); - $this->expectException(\Exception::class); $this->expectExceptionMessage('Warning: unexpected change of $USER'); phpunit_util::reset_all_data(true); @@ -309,15 +283,6 @@ STRING; global $COURSE; $COURSE->id = 10; - // Let's convert the user warnings into an assert-able exception. - set_error_handler( - static function ($errno, $errstr) { - restore_error_handler(); - throw new \Exception($errstr, $errno); - }, - E_USER_WARNING // Or any other specific E_ that we want to assert. - ); - $this->expectException(\Exception::class); $this->expectExceptionMessage('Warning: unexpected change of $COURSE'); phpunit_util::reset_all_data(true); @@ -338,15 +303,6 @@ STRING; $USER->id = 10; $COURSE->id = 10; - // Let's convert the user warnings into an assert-able exception. - set_error_handler( - static function ($errno, $errstr) { - restore_error_handler(); - throw new \Exception($errstr, $errno); - }, - E_USER_WARNING // Or any other specific E_ that we want to assert. - ); - $this->expectException(\Exception::class); $this->expectExceptionMessageMatches('/resetting.*rolesactive.*new.*removal.*USER.*COURSE/ms'); // 6 messages matched. phpunit_util::reset_all_data(true); diff --git a/lib/phpunit/tests/phpunit_dataset_test.php b/lib/phpunit/tests/phpunit_dataset_test.php index 0fe7f845ce0..68fc6ee3855 100644 --- a/lib/phpunit/tests/phpunit_dataset_test.php +++ b/lib/phpunit/tests/phpunit_dataset_test.php @@ -199,7 +199,7 @@ final class phpunit_dataset_test extends advanced_testcase { 'rows' => [], ], 'csv loads ok' => [ - 'fullpath' => file_get_contents(__DIR__ . '/fixtures/sample_dataset.csv'), + 'content' => file_get_contents(__DIR__ . '/fixtures/sample_dataset.csv'), 'type' => 'csv', 'tablename' => 'user', 'exception' => null, @@ -215,7 +215,7 @@ final class phpunit_dataset_test extends advanced_testcase { ], ], 'xml loads ok' => [ - 'fullpath' => file_get_contents(__DIR__ . '/fixtures/sample_dataset.xml'), + 'content' => file_get_contents(__DIR__ . '/fixtures/sample_dataset.xml'), 'type' => 'xml', 'tablename' => 'user', 'exception' => null, diff --git a/lib/testing/classes/privacy/provider.php b/lib/testing/classes/privacy/provider.php new file mode 100644 index 00000000000..6679ed1d34d --- /dev/null +++ b/lib/testing/classes/privacy/provider.php @@ -0,0 +1,65 @@ +. + +/** + * Privacy Subsystem implementation for core_cache. + * + * @package core_cache + * @copyright 2018 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_cache\privacy; + +use core_privacy\local\metadata\collection; + +/** + * Privacy Subsystem implementation for core_cache. + * + * @copyright 2018 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class provider implements + // Caches store data. + \core_privacy\local\metadata\provider, + + // The cache subsystem stores data on behalf of other components. + \core_privacy\local\request\subsystem\plugin_provider, + \core_privacy\local\request\shared_userlist_provider +{ + /** + * Returns meta data about this system. + * + * Note, although this plugin does store user data, it is not able to + * identify it, and that user data is typically very short lived. + * + * Therefore it is not realistically possible to export any of this + * data as it is only identifiable by the plugin storing it, and that + * plugin should already be exporting the data as part of it's own + * implementation. + * + * @param collection $collection The initialised collection to add items to. + * @return collection A listing of user data stored through this system. + */ + public static function get_metadata(collection $collection): collection { + // Data is stored in cache stores. + $collection->add_plugintype_link('cachestore', [], 'privacy:metadata:cachestore'); + + // Cache locks do not store any personal user data. + + return $collection; + } +} diff --git a/lib/tests/accesslib_has_capability_test.php b/lib/tests/accesslib_has_capability_test.php index e88c4355657..deb94111e3f 100644 --- a/lib/tests/accesslib_has_capability_test.php +++ b/lib/tests/accesslib_has_capability_test.php @@ -367,32 +367,32 @@ final class accesslib_has_capability_test extends \advanced_testcase { public static function locked_context_provider(): array { return [ 'All unlocked' => [ - 'locked' => [ + 'lockedcontexts' => [ ], - 'blockedwrites' => [ + 'blocked' => [ ], ], 'User is locked (yes, this is weird)' => [ - 'locked' => [ + 'lockedcontexts' => [ 'adminuser' => true, ], - 'blockedwrites' => [ + 'blocked' => [ 'adminuser', ], ], 'Cat1/Block locked' => [ - 'locked' => [ + 'lockedcontexts' => [ 'cat1block' => true, ], - 'blockedwrites' => [ + 'blocked' => [ 'cat1block', ], ], 'Cat1' => [ - 'locked' => [ + 'lockedcontexts' => [ 'cat1' => true, ], - 'blockedwrites' => [ + 'blocked' => [ 'cat1', 'cat1block', 'cat1a', @@ -414,11 +414,11 @@ final class accesslib_has_capability_test extends \advanced_testcase { ], ], 'Cat1 locked and a child explicitly unlocked' => [ - 'locked' => [ + 'lockedcontexts' => [ 'cat1' => true, 'cat1a' => false, ], - 'blockedwrites' => [ + 'blocked' => [ 'cat1', 'cat1block', 'cat1a', diff --git a/lib/tests/classes/courses_tasks_testcase.php b/lib/tests/classes/courses_tasks_testcase.php index 10ee6357f92..2bf8fb990bc 100644 --- a/lib/tests/classes/courses_tasks_testcase.php +++ b/lib/tests/classes/courses_tasks_testcase.php @@ -32,46 +32,46 @@ abstract class courses_tasks_testcase extends \advanced_testcase { public static function get_courses_provider(): array { return [ 'No hidden courses' => [ - 'lastweek' => 0, - 'yesterday' => 0, - 'tomorrow' => 0, + 'lastweekcount' => 0, + 'yesterdaycount' => 0, + 'tomorrowcount' => 0, ], 'No hidden courses (without visible courses)' => [ - 'lastweek' => 0, - 'yesterday' => 0, - 'tomorrow' => 0, + 'lastweekcount' => 0, + 'yesterdaycount' => 0, + 'tomorrowcount' => 0, 'createvisible' => false, ], 'Hidden courses with last week or tomorrow dates' => [ - 'lastweek' => 2, - 'yesterday' => 0, - 'tomorrow' => 2, + 'lastweekcount' => 2, + 'yesterdaycount' => 0, + 'tomorrowcount' => 2, ], 'One hidden course of each type (last week, yesterday and tomorrow)' => [ - 'lastweek' => 1, - 'yesterday' => 1, - 'tomorrow' => 1, + 'lastweekcount' => 1, + 'yesterdaycount' => 1, + 'tomorrowcount' => 1, ], 'Different hidden courses of each type' => [ - 'lastweek' => 2, - 'yesterday' => 3, - 'tomorrow' => 4, + 'lastweekcount' => 2, + 'yesterdaycount' => 3, + 'tomorrowcount' => 4, ], 'A couple of hidden courses of each type (without visible courses)' => [ - 'lastweek' => 2, - 'yesterday' => 2, - 'tomorrow' => 2, + 'lastweekcount' => 2, + 'yesterdaycount' => 2, + 'tomorrowcount' => 2, 'createvisible' => false, ], - 'Only a few hidden courses for yesterday' => [ - 'lastweek' => 0, - 'yesterday' => 5, - 'tomorrow' => 0, + 'Only a few hidden courses for yesterdaycount' => [ + 'lastweekcount' => 0, + 'yesterdaycount' => 5, + 'tomorrowcount' => 0, ], 'Only a few hidden courses for yesterday (without visible courses)' => [ - 'lastweek' => 0, - 'yesterday' => 5, - 'tomorrow' => 0, + 'lastweekcount' => 0, + 'yesterdaycount' => 5, + 'tomorrowcount' => 0, 'createvisible' => false, ], ]; diff --git a/lib/tests/completionlib_test.php b/lib/tests/completionlib_test.php index 47bd8331616..e2df63d8140 100644 --- a/lib/tests/completionlib_test.php +++ b/lib/tests/completionlib_test.php @@ -76,7 +76,7 @@ final class completionlib_test extends advanced_testcase { * @param boolean $canonicalize * @param boolean $ignoreCase */ - public static function assertEquals($expected, $actual, string $message = '', float $delta = 0, int $maxDepth = 10, + public static function assertCompletionEquals($expected, $actual, string $message = '', float $delta = 0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void { // Nasty cheating hack: prevent random failures on timemodified field. if (is_array($actual) && (is_object($expected) || is_array($expected))) { @@ -104,33 +104,33 @@ final class completionlib_test extends advanced_testcase { // Config alone. $CFG->enablecompletion = COMPLETION_DISABLED; - $this->assertEquals(COMPLETION_DISABLED, completion_info::is_enabled_for_site()); + $this->assertCompletionEquals(COMPLETION_DISABLED, completion_info::is_enabled_for_site()); $CFG->enablecompletion = COMPLETION_ENABLED; - $this->assertEquals(COMPLETION_ENABLED, completion_info::is_enabled_for_site()); + $this->assertCompletionEquals(COMPLETION_ENABLED, completion_info::is_enabled_for_site()); // Course. $course = (object)array('id' => 13); $c = new completion_info($course); $course->enablecompletion = COMPLETION_DISABLED; - $this->assertEquals(COMPLETION_DISABLED, $c->is_enabled()); + $this->assertCompletionEquals(COMPLETION_DISABLED, $c->is_enabled()); $course->enablecompletion = COMPLETION_ENABLED; - $this->assertEquals(COMPLETION_ENABLED, $c->is_enabled()); + $this->assertCompletionEquals(COMPLETION_ENABLED, $c->is_enabled()); $CFG->enablecompletion = COMPLETION_DISABLED; - $this->assertEquals(COMPLETION_DISABLED, $c->is_enabled()); + $this->assertCompletionEquals(COMPLETION_DISABLED, $c->is_enabled()); // Course and CM. $cm = new stdClass(); $cm->completion = COMPLETION_TRACKING_MANUAL; - $this->assertEquals(COMPLETION_DISABLED, $c->is_enabled($cm)); + $this->assertCompletionEquals(COMPLETION_DISABLED, $c->is_enabled($cm)); $CFG->enablecompletion = COMPLETION_ENABLED; $course->enablecompletion = COMPLETION_DISABLED; - $this->assertEquals(COMPLETION_DISABLED, $c->is_enabled($cm)); + $this->assertCompletionEquals(COMPLETION_DISABLED, $c->is_enabled($cm)); $course->enablecompletion = COMPLETION_ENABLED; - $this->assertEquals(COMPLETION_TRACKING_MANUAL, $c->is_enabled($cm)); + $this->assertCompletionEquals(COMPLETION_TRACKING_MANUAL, $c->is_enabled($cm)); $cm->completion = COMPLETION_TRACKING_NONE; - $this->assertEquals(COMPLETION_TRACKING_NONE, $c->is_enabled($cm)); + $this->assertCompletionEquals(COMPLETION_TRACKING_NONE, $c->is_enabled($cm)); $cm->completion = COMPLETION_TRACKING_AUTOMATIC; - $this->assertEquals(COMPLETION_TRACKING_AUTOMATIC, $c->is_enabled($cm)); + $this->assertCompletionEquals(COMPLETION_TRACKING_AUTOMATIC, $c->is_enabled($cm)); } /** @@ -281,11 +281,11 @@ final class completionlib_test extends advanced_testcase { ): void { switch (self::getInvocationCount($setinvocations)) { case 1: - $this->assertEquals($cm, $comparecm); + $this->assertCompletionEquals($cm, $comparecm); $comparewith1->evaluate($comparewith); break; case 2: - $this->assertEquals($cm, $comparecm); + $this->assertCompletionEquals($cm, $comparecm); $comparewith2->evaluate($comparewith); break; default: @@ -407,7 +407,7 @@ final class completionlib_test extends advanced_testcase { $current = (object)['viewed' => COMPLETION_NOT_VIEWED]; $completioninfo = new completion_info($this->course); - $this->assertEquals($expectedstate, $completioninfo->internal_get_state($cm, $userid, $current)); + $this->assertCompletionEquals($expectedstate, $completioninfo->internal_get_state($cm, $userid, $current)); } /** @@ -503,7 +503,7 @@ final class completionlib_test extends advanced_testcase { // The target user already received a grade, so internal_get_state should be already complete. $completioninfo = new completion_info($this->course); - $this->assertEquals($expectedstate, $completioninfo->internal_get_state($cm, $userid, null)); + $this->assertCompletionEquals($expectedstate, $completioninfo->internal_get_state($cm, $userid, null)); } /** @@ -544,10 +544,10 @@ final class completionlib_test extends advanced_testcase { // The target user already received a grade, so internal_get_state should be already complete. $completioninfo = new completion_info($this->course); - $this->assertEquals(COMPLETION_COMPLETE, $completioninfo->internal_get_state($cm, $userid, null)); + $this->assertCompletionEquals(COMPLETION_COMPLETE, $completioninfo->internal_get_state($cm, $userid, null)); // As the teacher which does not have a grade in this cm, internal_get_state should return incomplete. - $this->assertEquals(COMPLETION_INCOMPLETE, $completioninfo->internal_get_state($cm, $teacher->id, null)); + $this->assertCompletionEquals(COMPLETION_INCOMPLETE, $completioninfo->internal_get_state($cm, $teacher->id, null)); } /** @@ -570,14 +570,14 @@ final class completionlib_test extends advanced_testcase { // Fetch completion for the user who hasn't made a choice yet. $completion = $completioninfo->internal_get_state($cminfo, $this->user->id, COMPLETION_INCOMPLETE); - $this->assertEquals(COMPLETION_INCOMPLETE, $completion); + $this->assertCompletionEquals(COMPLETION_INCOMPLETE, $completion); // Have the user make a choice. $choicewithoptions = choice_get_choice($choice->id); $optionids = array_keys($choicewithoptions->option); choice_user_submit_response($optionids[0], $choice, $this->user->id, $this->course, $cminfo); $completion = $completioninfo->internal_get_state($cminfo, $this->user->id, COMPLETION_INCOMPLETE); - $this->assertEquals(COMPLETION_COMPLETE, $completion); + $this->assertCompletionEquals(COMPLETION_COMPLETE, $completion); } /** @@ -654,7 +654,7 @@ final class completionlib_test extends advanced_testcase { ->will($this->returnValue(666)); $c = new completion_info($course); - $this->assertEquals(666, $c->count_user_data($cm)); + $this->assertCompletionEquals(666, $c->count_user_data($cm)); } /** @@ -712,17 +712,17 @@ final class completionlib_test extends advanced_testcase { $c->expects($updateinvocations) ->method('update_state') ->willReturnCallback(function ($comparecm, $state, $userid) use ($updateinvocations, $cm): void { - $this->assertEquals($cm, $comparecm); - $this->assertEquals(COMPLETION_UNKNOWN, $state); + $this->assertCompletionEquals($cm, $comparecm); + $this->assertCompletionEquals(COMPLETION_UNKNOWN, $state); switch (self::getInvocationCount($updateinvocations)) { case 1: - $this->assertEquals(100, $userid); + $this->assertCompletionEquals(100, $userid); break; case 2: - $this->assertEquals(101, $userid); + $this->assertCompletionEquals(101, $userid); break; case 3: - $this->assertEquals(201, $userid); + $this->assertCompletionEquals(201, $userid); break; default: $this->fail('Unexpected invocation count'); @@ -820,15 +820,15 @@ final class completionlib_test extends advanced_testcase { $result = $completioninfo->get_data($cm, $wholecourse, $user->id); // Course module ID of the returned completion data must match this activity's course module ID. - $this->assertEquals($cm->id, $result->coursemoduleid); + $this->assertCompletionEquals($cm->id, $result->coursemoduleid); // User ID of the returned completion data must match the user's ID. - $this->assertEquals($user->id, $result->userid); + $this->assertCompletionEquals($user->id, $result->userid); // The completion state of the returned completion data must match the expected completion state. - $this->assertEquals($completion, $result->completionstate); + $this->assertCompletionEquals($completion, $result->completionstate); // If the user has no completion record, then the default record should be returned. if (!$hasrecord) { - $this->assertEquals(0, $result->id); + $this->assertCompletionEquals(0, $result->id); } // Check that we are including relevant completion data for the module. @@ -889,8 +889,8 @@ final class completionlib_test extends advanced_testcase { $this->assertTrue(property_exists($result, 'timemodified')); $this->assertFalse(property_exists($result, 'other_cm_completion_data_fetched')); - $this->assertEquals($testcm->id, $result->coursemoduleid); - $this->assertEquals($this->user->id, $result->userid); + $this->assertCompletionEquals($testcm->id, $result->coursemoduleid); + $this->assertCompletionEquals($this->user->id, $result->userid); $results[$testcm->id] = $result; } @@ -902,7 +902,7 @@ final class completionlib_test extends advanced_testcase { (cache::make('core', 'completion'))->purge(); foreach ($modinfo->cms as $testcm) { $result = $completioninfo->get_data($testcm, false); - $this->assertEquals($result, $results[$testcm->id]); + $this->assertCompletionEquals($result, $results[$testcm->id]); } } @@ -939,13 +939,13 @@ final class completionlib_test extends advanced_testcase { $completiondatabeforeview = $completioninfo->get_completion_data($cm->id, $this->user->id, $defaultdata); $this->assertTrue(array_key_exists('viewed', $completiondatabeforeview)); $this->assertTrue(array_key_exists('coursemoduleid', $completiondatabeforeview)); - $this->assertEquals(0, $completiondatabeforeview['viewed']); - $this->assertEquals($cm->id, $completiondatabeforeview['coursemoduleid']); + $this->assertCompletionEquals(0, $completiondatabeforeview['viewed']); + $this->assertCompletionEquals($cm->id, $completiondatabeforeview['coursemoduleid']); // Mark as completed before viewing it. $completioninfo->update_state($cm, COMPLETION_COMPLETE, $this->user->id, true); $completiondatabeforeview = $completioninfo->get_completion_data($cm->id, $this->user->id, $defaultdata); - $this->assertEquals(0, $completiondatabeforeview['viewed']); + $this->assertCompletionEquals(0, $completiondatabeforeview['viewed']); // Set viewed. $completioninfo->set_module_viewed($cm, $this->user->id); @@ -953,16 +953,16 @@ final class completionlib_test extends advanced_testcase { $completiondata = $completioninfo->get_completion_data($cm->id, $this->user->id, $defaultdata); $this->assertTrue(array_key_exists('viewed', $completiondata)); $this->assertTrue(array_key_exists('coursemoduleid', $completiondata)); - $this->assertEquals(1, $completiondata['viewed']); - $this->assertEquals($cm->id, $completiondatabeforeview['coursemoduleid']); + $this->assertCompletionEquals(1, $completiondata['viewed']); + $this->assertCompletionEquals($cm->id, $completiondatabeforeview['coursemoduleid']); $completioninfo->reset_all_state($cm); $completiondataafterreset = $completioninfo->get_completion_data($cm->id, $this->user->id, $defaultdata); $this->assertTrue(array_key_exists('viewed', $completiondataafterreset)); $this->assertTrue(array_key_exists('coursemoduleid', $completiondataafterreset)); - $this->assertEquals(1, $completiondataafterreset['viewed']); - $this->assertEquals($cm->id, $completiondatabeforeview['coursemoduleid']); + $this->assertCompletionEquals(1, $completiondataafterreset['viewed']); + $this->assertCompletionEquals($cm->id, $completiondatabeforeview['coursemoduleid']); } /** @@ -1014,7 +1014,7 @@ final class completionlib_test extends advanced_testcase { $this->assertArrayHasKey('customcompletion', $choicecompletiondata); $this->assertArrayHasKey('completionsubmit', $choicecompletiondata['customcompletion']); - $this->assertEquals(COMPLETION_INCOMPLETE, $choicecompletiondata['customcompletion']['completionsubmit']); + $this->assertCompletionEquals(COMPLETION_INCOMPLETE, $choicecompletiondata['customcompletion']['completionsubmit']); // Mock a choice answer so user has completed the requirement. $choicemockinfo = [ @@ -1025,7 +1025,7 @@ final class completionlib_test extends advanced_testcase { // Confirm fetching again reflects the completion. $choicecompletiondata = $method->invoke($completioninfo, $cmchoice, $user->id); - $this->assertEquals(COMPLETION_COMPLETE, $choicecompletiondata['customcompletion']['completionsubmit']); + $this->assertCompletionEquals(COMPLETION_COMPLETE, $choicecompletiondata['customcompletion']['completionsubmit']); // Check that fetching data for a module with no custom completion still provides its grade completion status. $workshopcompletiondata = $method->invoke($completioninfo, $cmworkshop, $user->id); @@ -1033,8 +1033,8 @@ final class completionlib_test extends advanced_testcase { $this->assertArrayHasKey('completiongrade', $workshopcompletiondata); $this->assertArrayHasKey('passgrade', $workshopcompletiondata); $this->assertArrayNotHasKey('customcompletion', $workshopcompletiondata); - $this->assertEquals(COMPLETION_INCOMPLETE, $workshopcompletiondata['completiongrade']); - $this->assertEquals(COMPLETION_INCOMPLETE, $workshopcompletiondata['passgrade']); + $this->assertCompletionEquals(COMPLETION_INCOMPLETE, $workshopcompletiondata['completiongrade']); + $this->assertCompletionEquals(COMPLETION_INCOMPLETE, $workshopcompletiondata['passgrade']); // Check that fetching data for a module with no completion conditions does not provide any data. $choice2completiondata = $method->invoke($completioninfo, $cmchoice2, $user->id); @@ -1066,11 +1066,11 @@ final class completionlib_test extends advanced_testcase { $c->internal_set_data($cm, $data); $d1 = $DB->get_field('course_modules_completion', 'id', array('coursemoduleid' => $cm->id)); - $this->assertEquals($d1, $data->id); + $this->assertCompletionEquals($d1, $data->id); $cache = cache::make('core', 'completion'); // Cache was not set for another user. $cachevalue = $cache->get("{$data->userid}_{$cm->course}"); - $this->assertEquals([ + $this->assertCompletionEquals([ 'cacherev' => $this->course->cacherev, $cm->id => array_merge( (array) $data, @@ -1095,13 +1095,13 @@ final class completionlib_test extends advanced_testcase { $c->internal_set_data($cm2, $d2); // Cache for current user returns the data. $cachevalue = $cache->get($data->userid . '_' . $cm->course); - $this->assertEquals(array_merge( + $this->assertCompletionEquals(array_merge( (array) $data, ['other_cm_completion_data_fetched' => true] ), $cachevalue[$cm->id]); // Cache for another user is not filled. - $this->assertEquals(false, $cache->get($d2->userid . '_' . $cm2->course)); + $this->assertCompletionEquals(false, $cache->get($d2->userid . '_' . $cm2->course)); // 3) Test where it THINKS the data is new (from cache) but actually in the database it has been set since. $forum3 = $this->getDataGenerator()->create_module('forum', array('course' => $this->course->id), $completionauto); @@ -1141,14 +1141,14 @@ final class completionlib_test extends advanced_testcase { $data->coursemoduleid = $cm->id; $c->internal_set_data($cm, $data); $actual = $DB->get_records('course_completions'); - $this->assertEquals(1, count($actual)); - $this->assertEquals($this->user->id, reset($actual)->userid); + $this->assertCompletionEquals(1, count($actual)); + $this->assertCompletionEquals($this->user->id, reset($actual)->userid); $data->userid = $newuser2->id; $c->internal_set_data($cm, $data, true); $actual = $DB->get_records('course_completions'); - $this->assertEquals(1, count($actual)); - $this->assertEquals($this->user->id, reset($actual)->userid); + $this->assertCompletionEquals(1, count($actual)); + $this->assertCompletionEquals($this->user->id, reset($actual)->userid); } /** @@ -1180,7 +1180,7 @@ final class completionlib_test extends advanced_testcase { ->method('get_recordset_sql') ->will($this->returnValue(new core_completionlib_fake_recordset(array($progress1, $progress2)))); - $this->assertEquals(array( + $this->assertCompletionEquals(array( 100 => (object)array('id' => 100, 'firstname' => 'Woot', 'lastname' => 'Plugh', 'progress' => array(13 => $progress1)), 201 => (object)array('id' => 201, 'firstname' => 'Vroom', 'lastname' => 'Xyzzy', @@ -1220,10 +1220,10 @@ final class completionlib_test extends advanced_testcase { ->willReturnCallback(function ($paramids) use ($inorequalsinvocations, $ids) { switch (self::getInvocationCount($inorequalsinvocations)) { case 1: - $this->assertEquals(array_slice($ids, 0, 1000), $paramids); + $this->assertCompletionEquals(array_slice($ids, 0, 1000), $paramids); return [' IN whatever', []]; case 2: - $this->assertEquals(array_slice($ids, 1000), $paramids); + $this->assertCompletionEquals(array_slice($ids, 1000), $paramids); return [' IN whatever2', []]; default: $this->fail('Unexpected invocation count'); @@ -1343,32 +1343,32 @@ final class completionlib_test extends advanced_testcase { $grade->finalgrade = null; // Grade has pass mark and is not hidden, user passes. - $this->assertEquals( + $this->assertCompletionEquals( COMPLETION_COMPLETE_PASS, completion_info::internal_get_grade_state($item, $grade)); // Same but user fails. $grade->rawgrade = 3.9; - $this->assertEquals( + $this->assertCompletionEquals( COMPLETION_COMPLETE_FAIL, completion_info::internal_get_grade_state($item, $grade)); // User fails on raw grade but passes on final. $grade->finalgrade = 4.0; - $this->assertEquals( + $this->assertCompletionEquals( COMPLETION_COMPLETE_PASS, completion_info::internal_get_grade_state($item, $grade)); // Item is hidden. $item->hidden = 1; - $this->assertEquals( + $this->assertCompletionEquals( COMPLETION_COMPLETE, completion_info::internal_get_grade_state($item, $grade)); // Item isn't hidden but has no pass mark. $item->hidden = 0; $item->gradepass = 0; - $this->assertEquals( + $this->assertCompletionEquals( COMPLETION_COMPLETE, completion_info::internal_get_grade_state($item, $grade)); @@ -1376,7 +1376,7 @@ final class completionlib_test extends advanced_testcase { $item->hidden = 1; $item->gradepass = 4; $grade->finalgrade = 5.0; - $this->assertEquals( + $this->assertCompletionEquals( COMPLETION_COMPLETE_PASS, completion_info::internal_get_grade_state($item, $grade, true)); @@ -1384,7 +1384,7 @@ final class completionlib_test extends advanced_testcase { $item->hidden = 1; $item->gradepass = 4; $grade->finalgrade = 3.0; - $this->assertEquals( + $this->assertCompletionEquals( COMPLETION_COMPLETE_FAIL_HIDDEN, completion_info::internal_get_grade_state($item, $grade, true)); @@ -1392,7 +1392,7 @@ final class completionlib_test extends advanced_testcase { $item->hidden = 0; $item->gradepass = 4; $grade->finalgrade = 3.0; - $this->assertEquals( + $this->assertCompletionEquals( COMPLETION_COMPLETE_FAIL, completion_info::internal_get_grade_state($item, $grade, true)); } @@ -1522,9 +1522,9 @@ final class completionlib_test extends advanced_testcase { $c = new completion_info($this->course); $activities = $c->get_activities(); - $this->assertEquals(1, count($activities)); + $this->assertCompletionEquals(1, count($activities)); $this->assertTrue(isset($activities[$forum->cmid])); - $this->assertEquals($activities[$forum->cmid]->name, $forum->name); + $this->assertCompletionEquals($activities[$forum->cmid]->name, $forum->name); $current = $c->get_data($activities[$forum->cmid], false, $this->user->id); $current->completionstate = COMPLETION_COMPLETE; @@ -1534,12 +1534,12 @@ final class completionlib_test extends advanced_testcase { $events = $sink->get_events(); $event = reset($events); $this->assertInstanceOf('\core\event\course_module_completion_updated', $event); - $this->assertEquals($forum->cmid, + $this->assertCompletionEquals($forum->cmid, $event->get_record_snapshot('course_modules_completion', $event->objectid)->coursemoduleid); - $this->assertEquals($current, $event->get_record_snapshot('course_modules_completion', $event->objectid)); - $this->assertEquals(context_module::instance($forum->cmid), $event->get_context()); - $this->assertEquals($USER->id, $event->userid); - $this->assertEquals($this->user->id, $event->relateduserid); + $this->assertCompletionEquals($current, $event->get_record_snapshot('course_modules_completion', $event->objectid)); + $this->assertCompletionEquals(context_module::instance($forum->cmid), $event->get_context()); + $this->assertCompletionEquals($USER->id, $event->userid); + $this->assertCompletionEquals($this->user->id, $event->relateduserid); $this->assertInstanceOf('moodle_url', $event->get_url()); } @@ -1564,11 +1564,11 @@ final class completionlib_test extends advanced_testcase { $event = reset($events); $this->assertInstanceOf('\core\event\course_completed', $event); - $this->assertEquals($this->course->id, $event->get_record_snapshot('course_completions', $event->objectid)->course); - $this->assertEquals($this->course->id, $event->courseid); - $this->assertEquals($USER->id, $event->userid); - $this->assertEquals($this->user->id, $event->relateduserid); - $this->assertEquals(context_course::instance($this->course->id), $event->get_context()); + $this->assertCompletionEquals($this->course->id, $event->get_record_snapshot('course_completions', $event->objectid)->course); + $this->assertCompletionEquals($this->course->id, $event->courseid); + $this->assertCompletionEquals($USER->id, $event->userid); + $this->assertCompletionEquals($this->user->id, $event->relateduserid); + $this->assertCompletionEquals(context_course::instance($this->course->id), $event->get_context()); $this->assertInstanceOf('moodle_url', $event->get_url()); } @@ -1593,10 +1593,10 @@ final class completionlib_test extends advanced_testcase { $this->assertCount(1, $messages); $message = array_pop($messages); - $this->assertEquals(core_user::get_noreply_user()->id, $message->useridfrom); - $this->assertEquals($this->user->id, $message->useridto); - $this->assertEquals('coursecompleted', $message->eventtype); - $this->assertEquals(get_string('coursecompleted', 'completion'), $message->subject); + $this->assertCompletionEquals(core_user::get_noreply_user()->id, $message->useridfrom); + $this->assertCompletionEquals($this->user->id, $message->useridto); + $this->assertCompletionEquals('coursecompleted', $message->eventtype); + $this->assertCompletionEquals(get_string('coursecompleted', 'completion'), $message->subject); $this->assertStringContainsString($this->course->fullname, $message->fullmessage); } @@ -1623,8 +1623,8 @@ final class completionlib_test extends advanced_testcase { $sink->close(); $this->assertInstanceOf('\core\event\course_completion_updated', $event); - $this->assertEquals($this->course->id, $event->courseid); - $this->assertEquals($coursecontext, $event->get_context()); + $this->assertCompletionEquals($this->course->id, $event->courseid); + $this->assertCompletionEquals($coursecontext, $event->get_context()); $this->assertInstanceOf('moodle_url', $event->get_url()); } @@ -1694,7 +1694,7 @@ final class completionlib_test extends advanced_testcase { $this->expectException($expectedexception); } $gradecompletion = $completioninfo->get_grade_completion($cm, $this->user->id); - $this->assertEquals($expectedresult, $gradecompletion); + $this->assertCompletionEquals($expectedresult, $gradecompletion); } /** @@ -1725,7 +1725,7 @@ final class completionlib_test extends advanced_testcase { // Without the grade_item, the activity is considered incomplete. $completioninfo = new completion_info($this->course); - $this->assertEquals(COMPLETION_INCOMPLETE, $completioninfo->get_grade_completion($cm, $this->user->id)); + $this->assertCompletionEquals(COMPLETION_INCOMPLETE, $completioninfo->get_grade_completion($cm, $this->user->id)); // Once the activity is graded, the grade_item is automatically created. $assigninstance = new assign($cm->context, $cm, $this->course); @@ -1734,7 +1734,7 @@ final class completionlib_test extends advanced_testcase { $assigninstance->update_grade($grade); // The implicitly created grade_item does not have grade to pass defined so it is not distinguished. - $this->assertEquals(COMPLETION_COMPLETE, $completioninfo->get_grade_completion($cm, $this->user->id)); + $this->assertCompletionEquals(COMPLETION_COMPLETE, $completioninfo->get_grade_completion($cm, $this->user->id)); } /** @@ -1868,8 +1868,8 @@ final class completionlib_test extends advanced_testcase { $method = new ReflectionMethod($ccompletion, '_save'); $completionid = $method->invoke($ccompletion); $completions = $DB->get_records('course_completions'); - $this->assertEquals(count($completions), 1); - $this->assertEquals(reset($completions)->id, $completionid); + $this->assertCompletionEquals(count($completions), 1); + $this->assertCompletionEquals(reset($completions)->id, $completionid); $ccompletion->id = 0; $method = new ReflectionMethod($ccompletion, '_save'); @@ -1910,15 +1910,15 @@ final class completionlib_test extends advanced_testcase { $completionid = $ccompletion->mark_enrolled(); $completions = $DB->get_records('course_completions'); - $this->assertEquals(count($completions), 1); - $this->assertEquals(reset($completions)->id, $completionid); + $this->assertCompletionEquals(count($completions), 1); + $this->assertCompletionEquals(reset($completions)->id, $completionid); $ccompletion->id = 0; $completionid = $ccompletion->mark_enrolled(); $this->assertDebuggingCalled('Can not update data object, no id!'); $this->assertNull($completionid); $completions = $DB->get_records('course_completions'); - $this->assertEquals(1, count($completions)); + $this->assertCompletionEquals(1, count($completions)); } /** @@ -1953,15 +1953,15 @@ final class completionlib_test extends advanced_testcase { $completionid = $ccompletion->mark_inprogress(); $completions = $DB->get_records('course_completions'); - $this->assertEquals(1, count($completions)); - $this->assertEquals(reset($completions)->id, $completionid); + $this->assertCompletionEquals(1, count($completions)); + $this->assertCompletionEquals(reset($completions)->id, $completionid); $ccompletion->id = 0; $completionid = $ccompletion->mark_inprogress(); $this->assertDebuggingCalled('Can not update data object, no id!'); $this->assertNull($completionid); $completions = $DB->get_records('course_completions'); - $this->assertEquals(1, count($completions)); + $this->assertCompletionEquals(1, count($completions)); } /** @@ -1996,14 +1996,14 @@ final class completionlib_test extends advanced_testcase { $completionid = $ccompletion->mark_complete(); $completions = $DB->get_records('course_completions'); - $this->assertEquals(1, count($completions)); - $this->assertEquals(reset($completions)->id, $completionid); + $this->assertCompletionEquals(1, count($completions)); + $this->assertCompletionEquals(reset($completions)->id, $completionid); $ccompletion->id = 0; $completionid = $ccompletion->mark_complete(); $this->assertNull($completionid); $completions = $DB->get_records('course_completions'); - $this->assertEquals(1, count($completions)); + $this->assertCompletionEquals(1, count($completions)); } /** @@ -2040,8 +2040,8 @@ final class completionlib_test extends advanced_testcase { $completionid = $completion->mark_complete($record['timecompleted']); $completions = $DB->get_records('course_completions'); - $this->assertEquals(1, count($completions)); - $this->assertEquals(reset($completions)->id, $completionid); + $this->assertCompletionEquals(1, count($completions)); + $this->assertCompletionEquals(reset($completions)->id, $completionid); } /** diff --git a/lib/tests/component_test.php b/lib/tests/component_test.php index 7be2c638868..917d2ad450b 100644 --- a/lib/tests/component_test.php +++ b/lib/tests/component_test.php @@ -921,7 +921,7 @@ final class component_test extends \advanced_testcase { ], ], 'classname' => 'Psr\Http\Message\ServerRequestInterface', - 'includedfiles' => "{$dirroot}/lib/psr/http-message/src/ServerRequestInterface.php", + 'file' => "{$dirroot}/lib/psr/http-message/src/ServerRequestInterface.php", ], 'PSR-4 namespaces can come from multiple sources - second source' => [ 'psr0' => [], @@ -932,7 +932,7 @@ final class component_test extends \advanced_testcase { ], ], 'classname' => 'Psr\Http\Message\ServerRequestFactoryInterface', - 'includedfiles' => "{$dirroot}/lib/psr/http-factory/src/ServerRequestFactoryInterface.php", + 'file' => "{$dirroot}/lib/psr/http-factory/src/ServerRequestFactoryInterface.php", ], ]; } diff --git a/lib/tests/date_test.php b/lib/tests/date_test.php index ffd060e95e7..cf03bfc2750 100644 --- a/lib/tests/date_test.php +++ b/lib/tests/date_test.php @@ -308,7 +308,15 @@ final class date_test extends advanced_testcase { $this->assertSame('Pacific/Auckland', core_date::get_server_timezone()); // Admin should fix the settings. + set_error_handler(function ($errno, $errstr): void { + $this->assertStringContainsString('Unknown or bad timezone', $errstr); + restore_error_handler(); + }, E_ALL); $this->setTimezone('xxx/zzzz', 'Europe/Prague'); + set_error_handler(function ($errno, $errstr): void { + $this->assertStringContainsString('Unknown or bad timezone', $errstr); + restore_error_handler(); + }, E_ALL); $this->assertSame('Europe/Prague', core_date::get_server_timezone()); } @@ -490,17 +498,36 @@ final class date_test extends advanced_testcase { $this->assertSame('Europe/Prague', core_date::get_user_timezone(null)); $this->assertSame('Europe/Prague', core_date::get_user_timezone()); + $invokable = self::get_invokable(); + set_error_handler($invokable, E_ALL); $this->setTimezone('xxx/yyy', 'Europe/London'); + $this->assertCount(1, $invokable->get_invocations()); $USER->timezone = 'abc/def'; $CFG->forcetimezone = 'Europe/Berlin'; $this->assertSame('Europe/Berlin', core_date::get_user_timezone(null)); $this->assertSame('Europe/Berlin', core_date::get_user_timezone()); + $this->assertCount(1, $invokable->get_invocations()); + restore_error_handler(); + $invokable = self::get_invokable(); + set_error_handler($invokable, E_ALL); $this->setTimezone('xxx/yyy', 'Europe/London'); + $this->assertCount(1, $invokable->get_invocations()); + restore_error_handler(); + $USER->timezone = 'abc/def'; $CFG->forcetimezone = 99; + $invokable = self::get_invokable(); + set_error_handler($invokable, E_ALL); $this->assertSame('Europe/London', core_date::get_user_timezone(null)); + $this->assertCount(1, $invokable->get_invocations()); + restore_error_handler(); + + $invokable = self::get_invokable(); + set_error_handler($invokable, E_ALL); $this->assertSame('Europe/London', core_date::get_user_timezone()); + $this->assertCount(1, $invokable->get_invocations()); + restore_error_handler(); // User object parameter. $admin = get_admin(); @@ -572,14 +599,30 @@ final class date_test extends advanced_testcase { $this->assertSame('Europe/London', core_date::get_user_timezone('Europe/London')); $this->assertSame('Europe/Prague', core_date::get_user_timezone('xxx/zzz')); $USER->timezone = 'xxz/zzz'; - $this->assertSame('Europe/Prague', core_date::get_user_timezone('99')); + $invokable = self::get_invokable(); + set_error_handler($invokable, E_ALL); + $this->assertSame('Europe/Prague', core_date::get_user_timezone('99')); + $this->assertCount(0, $invokable->get_invocations()); + restore_error_handler(); + + $invokable = self::get_invokable(); + set_error_handler($invokable, E_ALL); $this->setTimezone('xxx', 'Europe/Prague'); + $this->assertCount(1, $invokable->get_invocations()); + restore_error_handler(); + $CFG->forcetimezone = '99'; $USER->timezone = 'xxx'; + $invokable = self::get_invokable(); + set_error_handler($invokable, E_ALL); $this->assertSame('Europe/Prague', core_date::get_user_timezone('99')); + $this->assertCount(1, $invokable->get_invocations()); $this->assertSame('Europe/Prague', core_date::get_user_timezone(99)); + $this->assertCount(2, $invokable->get_invocations()); $this->assertSame('Etc/GMT-1', core_date::get_user_timezone(1)); + $this->assertCount(2, $invokable->get_invocations()); + restore_error_handler(); $this->setTimezone('Europe/Prague'); $CFG->forcetimezone = 'Pacific/Auckland'; @@ -593,7 +636,11 @@ final class date_test extends advanced_testcase { $USER->timezone = 'Europe/London'; $CFG->forcetimezone = 99; $tz = new DateTimeZone('Pacific/Auckland'); + $invokable = self::get_invokable(); + set_error_handler($invokable, E_ALL); $this->assertSame('Pacific/Auckland', core_date::get_user_timezone($tz)); + $this->assertCount(0, $invokable->get_invocations()); + restore_error_handler(); } /** diff --git a/lib/tests/grouplib_test.php b/lib/tests/grouplib_test.php index 261df0bf51a..e34d6ce74e3 100644 --- a/lib/tests/grouplib_test.php +++ b/lib/tests/grouplib_test.php @@ -501,7 +501,7 @@ final class grouplib_test extends \advanced_testcase { 'userid' => $user2->id, 'groupnames' => $group1->name, ], - ], $records); + ], array_values($records)); } public function test_groups_get_group_by_name(): void { @@ -1158,7 +1158,7 @@ final class grouplib_test extends \advanced_testcase { $this->assertEquals([$c1group1->id], array_keys($groups)); $this->assertEqualsCanonicalizing( [$c1user1->id, $c12user1->id], - $groups[$c1group1->id]->members + array_values($groups[$c1group1->id]->members), ); } diff --git a/lib/tests/moodle_page_test.php b/lib/tests/moodle_page_test.php index 62af952a43a..60f13dc72ed 100644 --- a/lib/tests/moodle_page_test.php +++ b/lib/tests/moodle_page_test.php @@ -789,13 +789,13 @@ final class moodle_page_test extends \advanced_testcase { 'User not a member of any cohort' => [ 'usertheme' => '', 'sitetheme' => 'boost', - 'cohorts' => [], + 'cohortthemes' => [], 'expected' => 'boost', ], 'User member of one cohort which has a theme set' => [ 'usertheme' => '', 'sitetheme' => 'boost', - 'cohorts' => [ + 'cohortthemes' => [ 'classic', ], 'expected' => 'classic', @@ -803,7 +803,7 @@ final class moodle_page_test extends \advanced_testcase { 'User member of one cohort which has a theme set, and one without a theme' => [ 'usertheme' => '', 'sitetheme' => 'boost', - 'cohorts' => [ + 'cohortthemes' => [ 'classic', '', ], @@ -812,7 +812,7 @@ final class moodle_page_test extends \advanced_testcase { 'User member of one cohort which has a theme set, and one with a different theme' => [ 'usertheme' => '', 'sitetheme' => 'boost', - 'cohorts' => [ + 'cohortthemes' => [ 'classic', 'someother', ], @@ -821,13 +821,13 @@ final class moodle_page_test extends \advanced_testcase { 'User with a theme but not a member of any cohort' => [ 'usertheme' => 'classic', 'sitetheme' => 'boost', - 'cohorts' => [], + 'cohortthemes' => [], 'expected' => 'classic', ], 'User with a theme and member of one cohort which has a theme set' => [ 'usertheme' => 'classic', 'sitetheme' => 'boost', - 'cohorts' => [ + 'cohortthemes' => [ 'boost', ], 'expected' => 'classic', diff --git a/lib/tests/moodlelib_partial_test.php b/lib/tests/moodlelib_partial_test.php index 9f5832e8dc3..8e774f694cf 100644 --- a/lib/tests/moodlelib_partial_test.php +++ b/lib/tests/moodlelib_partial_test.php @@ -44,6 +44,26 @@ final class moodlelib_partial_test extends \advanced_testcase { $this->assertEquals($expected, partial($callable, ...$initialargs)(...$calledargs)); } + public function test_partial_args_intance_methods(): void { + // Using named args on initial args only - instance method. + $this->assertEquals( + 'foo/bar/baz/bum', + partial( + [$this, 'example_instance_method'], + ...['foo' => 'foo'] + )(...['bar', 'baz', 'bum']), + ); + + // Using named args on called args only - instance method. + $this->assertEquals( + 'foo/bar/baz/bum', + partial( + [$this, 'example_instance_method'], + ...['foo' => 'foo'] + )(...['bar' => 'bar', 'baz' => 'baz', 'bum' => 'bum']), + ); + } + /** * An example static method as part of the testcase. * @@ -109,18 +129,6 @@ final class moodlelib_partial_test extends \advanced_testcase { ['needle' => 'foo'], true, ], - 'Using named args on initial args only - instance method' => [ - [new self(), 'example_instance_method'], - ['foo' => 'foo'], - ['bar', 'baz', 'bum'], - 'foo/bar/baz/bum', - ], - 'Using named args on called args only - instance method' => [ - [new self(), 'example_instance_method'], - ['foo'], - ['bar' => 'bar', 'baz' => 'baz', 'bum' => 'bum'], - 'foo/bar/baz/bum', - ], 'Using named args on initial args only - static method' => [ [self::class, 'example_static_method'], ['foo' => 'foo'], diff --git a/lib/tests/moodlelib_test.php b/lib/tests/moodlelib_test.php index 9df9b3c5e62..95c841b30be 100644 --- a/lib/tests/moodlelib_test.php +++ b/lib/tests/moodlelib_test.php @@ -3215,14 +3215,14 @@ EOF; return array( 'nopath' => array( 'wwwroot' => 'http://www.example.com', - 'ids' => array( + 'msgids' => array( 'a-custom-id' => '', 'an-id-with-/-a-slash' => '', ), ), 'path' => array( 'wwwroot' => 'http://www.example.com/path/subdir', - 'ids' => array( + 'msgids' => array( 'a-custom-id' => '', 'an-id-with-/-a-slash' => '', ), @@ -3283,7 +3283,7 @@ EOF; 'nodiverts' => array( 'divertallemailsto' => null, 'divertallemailsexcept' => null, - array( + 'addresses' => array( 'foo@example.com', 'test@real.com', 'fred.jones@example.com', @@ -3291,12 +3291,12 @@ EOF; 'fred@example.com', 'fred+verp@example.com', ), - false, + 'expected' => false, ), 'alldiverts' => array( 'divertallemailsto' => 'somewhere@elsewhere.com', 'divertallemailsexcept' => null, - array( + 'addresses' => array( 'foo@example.com', 'test@real.com', 'fred.jones@example.com', @@ -3304,65 +3304,65 @@ EOF; 'fred@example.com', 'fred+verp@example.com', ), - true, + 'expected' => true, ), 'alsodiverts' => array( 'divertallemailsto' => 'somewhere@elsewhere.com', 'divertallemailsexcept' => '@dev.com, fred(\+.*)?@example.com', - array( + 'addresses' => array( 'foo@example.com', 'test@real.com', 'fred.jones@example.com', 'Fred.Jones@Example.com', ), - true, + 'expected' => true, ), 'divertsexceptions' => array( 'divertallemailsto' => 'somewhere@elsewhere.com', 'divertallemailsexcept' => '@dev.com, fred(\+.*)?@example.com', - array( + 'addresses' => array( 'dev1@dev.com', 'fred@example.com', 'Fred@Example.com', 'fred+verp@example.com', ), - false, + 'expected' => false, ), 'divertsexceptionsnewline' => array( 'divertallemailsto' => 'somewhere@elsewhere.com', 'divertallemailsexcept' => "@dev.com\nfred(\+.*)?@example.com", - array( + 'addresses' => array( 'dev1@dev.com', 'fred@example.com', 'fred+verp@example.com', ), - false, + 'expected' => false, ), 'alsodivertsnewline' => array( 'divertallemailsto' => 'somewhere@elsewhere.com', 'divertallemailsexcept' => "@dev.com\nfred(\+.*)?@example.com", - array( + 'addresses' => array( 'foo@example.com', 'test@real.com', 'fred.jones@example.com', ), - true, + 'expected' => true, ), 'alsodivertsblankline' => array( 'divertallemailsto' => 'somewhere@elsewhere.com', 'divertallemailsexcept' => "@dev.com\n", - [ + 'addresses' => [ 'lionel@example.com', ], - true, + 'expected' => true, ), 'divertsexceptionblankline' => array( 'divertallemailsto' => 'somewhere@elsewhere.com', 'divertallemailsexcept' => "@example.com\n", - [ + 'addresses' => [ 'lionel@example.com', ], - false, + 'expected' => false, ), ); } diff --git a/lib/tests/moodlenet/activity_sender_test.php b/lib/tests/moodlenet/activity_sender_test.php index 7dea40b07d5..13ec211433d 100644 --- a/lib/tests/moodlenet/activity_sender_test.php +++ b/lib/tests/moodlenet/activity_sender_test.php @@ -258,7 +258,7 @@ The last word of this sentence is in bold', $processeddescription); public static function share_resource_provider(): array { return [ 'Success' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 201, ['Content-Type' => 'application/json'], json_encode([ @@ -271,7 +271,7 @@ The last word of this sentence is in bold', $processeddescription); ], ], 'Fail with 200 status code' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -284,7 +284,7 @@ The last word of this sentence is in bold', $processeddescription); ], ], 'Fail with 401 status code' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 401, ), 'expected' => [ @@ -296,7 +296,7 @@ The last word of this sentence is in bold', $processeddescription); ], ], 'Fail with 404 status code' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 404, ), 'expected' => [ diff --git a/lib/tests/moodlenet/course_partial_sender_test.php b/lib/tests/moodlenet/course_partial_sender_test.php index d3047d992b3..633b4c5b79a 100644 --- a/lib/tests/moodlenet/course_partial_sender_test.php +++ b/lib/tests/moodlenet/course_partial_sender_test.php @@ -258,7 +258,7 @@ The last word of this sentence is in bold', $processeddescription); public static function share_resource_provider(): array { return [ 'Success' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 201, ['Content-Type' => 'application/json'], json_encode([ @@ -271,7 +271,7 @@ The last word of this sentence is in bold', $processeddescription); ], ], 'Fail with 200 status code' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -284,7 +284,7 @@ The last word of this sentence is in bold', $processeddescription); ], ], 'Fail with 401 status code' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 401, ), 'expected' => [ @@ -296,7 +296,7 @@ The last word of this sentence is in bold', $processeddescription); ], ], 'Fail with 404 status code' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 404, ), 'expected' => [ diff --git a/lib/tests/moodlenet/course_sender_test.php b/lib/tests/moodlenet/course_sender_test.php index b1d3e24caf0..f59bd85c1ed 100644 --- a/lib/tests/moodlenet/course_sender_test.php +++ b/lib/tests/moodlenet/course_sender_test.php @@ -262,7 +262,7 @@ The last word of this sentence is in bold', $processeddescription); public static function share_resource_provider(): array { return [ 'Success' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 201, ['Content-Type' => 'application/json'], json_encode([ @@ -275,7 +275,7 @@ The last word of this sentence is in bold', $processeddescription); ], ], 'Fail with 200 status code' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -288,7 +288,7 @@ The last word of this sentence is in bold', $processeddescription); ], ], 'Fail with 401 status code' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 401, ), 'expected' => [ @@ -300,7 +300,7 @@ The last word of this sentence is in bold', $processeddescription); ], ], 'Fail with 404 status code' => [ - 'http_response' => new Response( + 'httpresponse' => new Response( 404, ), 'expected' => [ diff --git a/lib/tests/oauth2/discovery/auth_server_config_reader_test.php b/lib/tests/oauth2/discovery/auth_server_config_reader_test.php index 711de18b809..55822a62b67 100644 --- a/lib/tests/oauth2/discovery/auth_server_config_reader_test.php +++ b/lib/tests/oauth2/discovery/auth_server_config_reader_test.php @@ -86,8 +86,8 @@ final class auth_server_config_reader_test extends \advanced_testcase { public static function config_provider(): array { return [ 'Valid, good issuer URL, good config' => [ - 'issuer_url' => 'https://app.example.com', - 'http_response' => new Response( + 'issuerurl' => 'https://app.example.com', + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -122,7 +122,7 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ]) ), - 'well_known_suffix' => null, + 'altwellknownsuffix' => null, 'expected' => [ 'request' => [ 'url' => 'https://app.example.com/.well-known/oauth-authorization-server' @@ -161,8 +161,8 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ], 'Valid, issuer URL with path component confirming well known suffix placement' => [ - 'issuer_url' => 'https://app.example.com/some/path', - 'http_response' => new Response( + 'issuerurl' => 'https://app.example.com/some/path', + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -197,7 +197,7 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ]) ), - 'well_known_suffix' => null, + 'altwellknownsuffix' => null, 'expected' => [ 'request' => [ 'url' => 'https://app.example.com/.well-known/oauth-authorization-server/some/path' @@ -236,8 +236,8 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ], 'Valid, single trailing / path only' => [ - 'issuer_url' => 'https://app.example.com/', - 'http_response' => new Response( + 'issuerurl' => 'https://app.example.com/', + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -272,7 +272,7 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ]) ), - 'well_known_suffix' => null, + 'altwellknownsuffix' => null, 'expected' => [ 'request' => [ 'url' => 'https://app.example.com/.well-known/oauth-authorization-server' @@ -311,8 +311,8 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ], 'Invalid, non HTTPS issuer URL' => [ - 'issuer_url' => 'http://app.example.com', - 'http_response' => new Response( + 'issuerurl' => 'http://app.example.com', + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -347,14 +347,14 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ]) ), - 'well_known_suffix' => null, + 'altwellknownsuffix' => null, 'expected' => [ 'exception' => \moodle_exception::class ] ], 'Invalid, query string in issuer URL' => [ - 'issuer_url' => 'https://app.example.com?test=cat', - 'http_response' => new Response( + 'issuerurl' => 'https://app.example.com?test=cat', + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -389,14 +389,14 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ]) ), - 'well_known_suffix' => null, + 'altwellknownsuffix' => null, 'expected' => [ 'exception' => \moodle_exception::class ] ], 'Invalid, fragment in issuer URL' => [ - 'issuer_url' => 'https://app.example.com/#cat', - 'http_response' => new Response( + 'issuerurl' => 'https://app.example.com/#cat', + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -431,14 +431,14 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ]) ), - 'well_known_suffix' => null, + 'altwellknownsuffix' => null, 'expected' => [ 'exception' => \moodle_exception::class ] ], 'Valid, port in issuer URL' => [ - 'issuer_url' => 'https://app.example.com:8080/some/path', - 'http_response' => new Response( + 'issuerurl' => 'https://app.example.com:8080/some/path', + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -473,7 +473,7 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ]) ), - 'well_known_suffix' => null, + 'altwellknownsuffix' => null, 'expected' => [ 'request' => [ 'url' => 'https://app.example.com:8080/.well-known/oauth-authorization-server/some/path' @@ -512,8 +512,8 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ], 'Valid, alternate well known suffix, no path' => [ - 'issuer_url' => 'https://app.example.com', - 'http_response' => new Response( + 'issuerurl' => 'https://app.example.com', + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -548,7 +548,7 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ]) ), - 'well_known_suffix' => 'openid-configuration', // An application using the openid well known, which is valid. + 'altwellknownsuffix' => 'openid-configuration', // An application using the openid well known, which is valid. 'expected' => [ 'request' => [ 'url' => 'https://app.example.com/.well-known/openid-configuration' @@ -587,8 +587,8 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ], 'Valid, alternate well known suffix, with path' => [ - 'issuer_url' => 'https://app.example.com/some/path/', - 'http_response' => new Response( + 'issuerurl' => 'https://app.example.com/some/path/', + 'httpresponse' => new Response( 200, ['Content-Type' => 'application/json'], json_encode([ @@ -623,7 +623,7 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ]) ), - 'well_known_suffix' => 'openid-configuration', // An application using the openid well known, which is valid. + 'altwellknownsuffix' => 'openid-configuration', // An application using the openid well known, which is valid. 'expected' => [ 'request' => [ 'url' => 'https://app.example.com/.well-known/openid-configuration/some/path/' @@ -662,9 +662,9 @@ final class auth_server_config_reader_test extends \advanced_testcase { ] ], 'Invalid, bad response' => [ - 'issuer_url' => 'https://app.example.com', - 'http_response' => new Response(404), - 'well_known_suffix' => null, + 'issuerurl' => 'https://app.example.com', + 'httpresponse' => new Response(404), + 'altwellknownsuffix' => null, 'expected' => [ 'exception' => ClientException::class ] diff --git a/lib/tests/plugininfo/editor_test.php b/lib/tests/plugininfo/editor_test.php index 9459caf5387..1d644bbfc28 100644 --- a/lib/tests/plugininfo/editor_test.php +++ b/lib/tests/plugininfo/editor_test.php @@ -211,7 +211,7 @@ final class editor_test extends advanced_testcase { 'texteditors' => 'textarea,tiny', 'pluginname' => 'textarea', 'direction' => base::MOVE_DOWN, - 'expected' => $getorder([ + 'neworder' => $getorder([ 'tiny', 'textarea', ]), @@ -222,7 +222,7 @@ final class editor_test extends advanced_testcase { 'pluginname' => 'tiny', 'direction' => base::MOVE_DOWN, // Tiny is already at the bottom of the enabled plugins. - 'expected' => $getorder([ + 'neworder' => $getorder([ 'textarea', 'tiny', ]), @@ -233,7 +233,7 @@ final class editor_test extends advanced_testcase { 'pluginname' => 'atto', 'direction' => base::MOVE_DOWN, // Atto is not enabled. No change expected. - 'expected' => $getorder([ + 'neworder' => $getorder([ 'textarea', 'tiny', ]), @@ -243,7 +243,7 @@ final class editor_test extends advanced_testcase { 'texteditors' => 'textarea,tiny', 'pluginname' => 'tiny', 'direction' => base::MOVE_UP, - 'expected' => $getorder([ + 'neworder' => $getorder([ 'tiny', 'textarea', ]), @@ -254,7 +254,7 @@ final class editor_test extends advanced_testcase { 'pluginname' => 'tiny', 'direction' => base::MOVE_UP, // Tiny is already at the top of the enabled plugins. - 'expected' => $getorder([ + 'neworder' => $getorder([ 'tiny', 'textarea', ]), @@ -265,7 +265,7 @@ final class editor_test extends advanced_testcase { 'pluginname' => 'atto', 'direction' => base::MOVE_UP, // Atto is not enabled. No change expected. - 'expected' => $getorder([ + 'neworder' => $getorder([ 'textarea', 'tiny', ]), @@ -276,7 +276,7 @@ final class editor_test extends advanced_testcase { 'pluginname' => 'atto', 'direction' => base::MOVE_UP, // Atto is not enabled. No change expected. - 'expected' => $getorder([ + 'neworder' => $getorder([ 'textarea', 'tiny', ]), @@ -287,7 +287,7 @@ final class editor_test extends advanced_testcase { 'pluginname' => 'fakeeditor', 'direction' => base::MOVE_UP, // The fakeeditor plugin does not exist. No change expected. - 'expected' => $getorder([ + 'neworder' => $getorder([ 'textarea', 'tiny', ]), diff --git a/lib/tests/plugininfo/media_test.php b/lib/tests/plugininfo/media_test.php index db2e39051f1..3da45b06ce3 100644 --- a/lib/tests/plugininfo/media_test.php +++ b/lib/tests/plugininfo/media_test.php @@ -83,13 +83,13 @@ final class media_test extends advanced_testcase { * @param string $initialorder * @param string $pluginname * @param int $direction - * @param array $neworder + * @param array $expected */ public function test_change_plugin_order( array $initialorder, string $pluginname, int $direction, - array $neworder, + array $expected, ): void { $this->resetAfterTest(true); @@ -97,7 +97,7 @@ final class media_test extends advanced_testcase { media::change_plugin_order($pluginname, $direction); $this->assertSame( - $neworder, + $expected, array_keys(media::get_sorted_plugins()), ); } diff --git a/lib/tests/questionlib_test.php b/lib/tests/questionlib_test.php index 618b5ff0f0d..9dcd362524f 100644 --- a/lib/tests/questionlib_test.php +++ b/lib/tests/questionlib_test.php @@ -662,7 +662,7 @@ final class questionlib_test extends \advanced_testcase { 'capabilities' => [ 'moodle/question:config' => CAP_ALLOW, ], - 'testcapability' => 'config', + 'capability' => 'config', 'isowner' => true, 'expect' => true, ], @@ -670,21 +670,21 @@ final class questionlib_test extends \advanced_testcase { 'capabilities' => [ 'moodle/question:config' => CAP_ALLOW, ], - 'testcapability' => 'config', + 'capability' => 'config', 'isowner' => false, 'expect' => true, ], 'Unrelated capability which is not set' => [ 'capabilities' => [ ], - 'testcapability' => 'config', + 'capability' => 'config', 'isowner' => true, 'expect' => false, ], 'Unrelated capability which is not set (not owner)' => [ 'capabilities' => [ ], - 'testcapability' => 'config', + 'capability' => 'config', 'isowner' => false, 'expect' => false, ], @@ -692,7 +692,7 @@ final class questionlib_test extends \advanced_testcase { 'capabilities' => [ 'moodle/question:config' => CAP_PREVENT, ], - 'testcapability' => 'config', + 'capability' => 'config', 'isowner' => true, 'expect' => false, ], @@ -700,21 +700,21 @@ final class questionlib_test extends \advanced_testcase { 'capabilities' => [ 'moodle/question:config' => CAP_PREVENT, ], - 'testcapability' => 'config', + 'capability' => 'config', 'isowner' => false, 'expect' => false, ], 'Related capability which is not set' => [ 'capabilities' => [ ], - 'testcapability' => 'edit', + 'capability' => 'edit', 'isowner' => true, 'expect' => false, ], 'Related capability which is not set (not owner)' => [ 'capabilities' => [ ], - 'testcapability' => 'edit', + 'capability' => 'edit', 'isowner' => false, 'expect' => false, ], @@ -722,7 +722,7 @@ final class questionlib_test extends \advanced_testcase { 'capabilities' => [ 'moodle/question:editall' => CAP_ALLOW, ], - 'testcapability' => 'edit', + 'capability' => 'edit', 'isowner' => true, 'expect' => true, ], @@ -730,7 +730,7 @@ final class questionlib_test extends \advanced_testcase { 'capabilities' => [ 'moodle/question:editall' => CAP_ALLOW, ], - 'testcapability' => 'edit', + 'capability' => 'edit', 'isowner' => false, 'expect' => true, ], @@ -739,7 +739,7 @@ final class questionlib_test extends \advanced_testcase { 'moodle/question:editall' => CAP_ALLOW, 'moodle/question:editmine' => CAP_PREVENT, ], - 'testcapability' => 'edit', + 'capability' => 'edit', 'isowner' => true, 'expect' => true, ], @@ -748,7 +748,7 @@ final class questionlib_test extends \advanced_testcase { 'moodle/question:editall' => CAP_ALLOW, 'moodle/question:editmine' => CAP_PREVENT, ], - 'testcapability' => 'edit', + 'capability' => 'edit', 'isowner' => false, 'expect' => true, ], @@ -757,7 +757,7 @@ final class questionlib_test extends \advanced_testcase { 'moodle/question:editall' => CAP_PREVENT, 'moodle/question:editmine' => CAP_ALLOW, ], - 'testcapability' => 'edit', + 'capability' => 'edit', 'isowner' => true, 'expect' => true, ], @@ -766,7 +766,7 @@ final class questionlib_test extends \advanced_testcase { 'moodle/question:editall' => CAP_PREVENT, 'moodle/question:editmine' => CAP_ALLOW, ], - 'testcapability' => 'edit', + 'capability' => 'edit', 'isowner' => false, 'expect' => false, ], diff --git a/lib/tests/rtlcss_test.php b/lib/tests/rtlcss_test.php index b431e041ba6..384ccadc073 100644 --- a/lib/tests/rtlcss_test.php +++ b/lib/tests/rtlcss_test.php @@ -40,7 +40,7 @@ final class rtlcss_test extends basic_testcase { */ public static function background_image_provider(): array { return [ - /* Not supported by MoodleHQ/RTLCSS yet. + // Not supported by MoodleHQ/RTLCSS yet. [[ 'should' => 'Should process string map in url (processUrls:true)', 'expected' => 'div { background-image: url(images/rtl.png), url(images/right.png);}', @@ -70,7 +70,6 @@ final class rtlcss_test extends basic_testcase { 'reversable' => true, 'skip' => true ]] - */ ]; } @@ -421,7 +420,7 @@ final class rtlcss_test extends basic_testcase { */ public static function special_provider(): array { return [ - /* Not supported by MoodleHQ/RTLCSS yet. + // Not supported by MoodleHQ/RTLCSS yet. [[ 'should' => 'Should not negate tokens', 'expected' => 'div { box-shadow: rgba(0, 128, 128, .98) inset -5em 1em 0;}', @@ -429,7 +428,6 @@ final class rtlcss_test extends basic_testcase { 'reversable' => true, 'skip' => true, ]] - */ ]; } @@ -614,7 +612,7 @@ final class rtlcss_test extends basic_testcase { */ public static function transforms_provider(): array { return [ - /* Not supported by MoodleHQ/RTLCSS yet. + // Not supported by MoodleHQ/RTLCSS yet. [[ 'should' => 'Should mirror transform : matrix', 'expected' => 'div { transform: matrix(2, 0.1, 20.75, 2, 2, 2); }', @@ -888,7 +886,6 @@ final class rtlcss_test extends basic_testcase { 'reversable' => false, 'skip' => true ]] - */ ]; } diff --git a/lib/tests/scss_test.php b/lib/tests/scss_test.php index 2cf4c630051..54c603217f4 100644 --- a/lib/tests/scss_test.php +++ b/lib/tests/scss_test.php @@ -132,9 +132,9 @@ CSS * * @dataProvider scss_compilation_provider * @param string $scss The raw scss to compile. - * @param string $expectedcss The expected CSS output. + * @param string $expected The expected CSS output. */ - public function test_scss_compilation_with_sassc($scss, $expectedcss): void { + public function test_scss_compilation_with_sassc($scss, $expected): void { if (!defined('PHPUNIT_PATH_TO_SASSC')) { $this->markTestSkipped('Path to SassC not provided'); } @@ -142,6 +142,6 @@ CSS $this->resetAfterTest(); set_config('pathtosassc', PHPUNIT_PATH_TO_SASSC); $compiler = new core_scss(); - $this->assertSame($compiler->compile($scss), $expectedcss); + $this->assertSame($compiler->compile($scss), $expected); } } diff --git a/lib/tests/session/utility/cookie_helper_test.php b/lib/tests/session/utility/cookie_helper_test.php index 7fe2a140f6c..86c49731c77 100644 --- a/lib/tests/session/utility/cookie_helper_test.php +++ b/lib/tests/session/utility/cookie_helper_test.php @@ -65,7 +65,7 @@ final class cookie_helper_test extends \advanced_testcase { 'Secure', ], 'casesensitive' => false, - 'output' => [ + 'expectedheaders' => [ 'Set-Cookie: testcookie=value; path=/test/; HttpOnly; Partitioned; SameSite=None; Secure;', ], ], @@ -84,7 +84,7 @@ final class cookie_helper_test extends \advanced_testcase { 'Secure', ], 'casesensitive' => false, - 'output' => [ + 'expectedheaders' => [ 'Set-Cookie: testcookie=value; path=/test/; HttpOnly; Partitioned; SameSite=None; Secure;', 'Set-Cookie: mytestcookie=value; path=/test/; HttpOnly; Partitioned; SameSite=None; Secure;', ], @@ -107,7 +107,7 @@ final class cookie_helper_test extends \advanced_testcase { 'Secure', ], 'casesensitive' => false, - 'output' => [ + 'expectedheaders' => [ 'Set-Cookie: testcookie=value; path=/test/; HttpOnly; Partitioned; SameSite=None; Secure;', 'Set-Cookie: mytestcookie=value; path=/test/; HttpOnly; Partitioned; SameSite=None; Secure;', 'Set-Cookie: anothertestcookie=value; path=/test/; HttpOnly;', @@ -129,7 +129,7 @@ final class cookie_helper_test extends \advanced_testcase { 'Secure', ], 'casesensitive' => false, - 'output' => [ + 'expectedheaders' => [ 'Set-Cookie: testcookie=value; path=/test/; secure; HttpOnly; Partitioned; SameSite=None', 'Set-Cookie: mytestcookie=value; path=/test/; secure; HttpOnly; SameSite=None; Partitioned;', ], @@ -150,7 +150,7 @@ final class cookie_helper_test extends \advanced_testcase { 'Secure', ], 'casesensitive' => true, - 'output' => [ + 'expectedheaders' => [ 'Set-Cookie: testcookie=value; path=/test/; secure; HttpOnly; SameSite=None; partitioned; Partitioned; Secure;', 'Set-Cookie: mytestcookie=value; path=/test/; secure; HttpOnly; SameSite=None; Partitioned; Secure;', ], @@ -167,7 +167,7 @@ final class cookie_helper_test extends \advanced_testcase { 'Secure', ], 'casesensitive' => false, - 'output' => [ + 'expectedheaders' => [ 'Set-Cookie: testcookie=value; path=/test/; secure; HttpOnly; SameSite=None; partitioned', 'Set-Cookie: mytestcookie=value; path=/test/; secure; HttpOnly; SameSite=None', ], @@ -183,7 +183,7 @@ final class cookie_helper_test extends \advanced_testcase { ], 'attributes' => [], 'casesensitive' => false, - 'output' => [ + 'expectedheaders' => [ 'Set-Cookie: testcookie=value; path=/test/; secure; HttpOnly; SameSite=None; partitioned', 'Set-Cookie: mytestcookie=value; path=/test/; secure; HttpOnly; SameSite=None', ], @@ -204,7 +204,7 @@ final class cookie_helper_test extends \advanced_testcase { 'Secure', ], 'casesensitive' => false, - 'output' => [ + 'expectedheaders' => [ 'Authorization: blah', 'Set-Cookie: testcookie=value; path=/test/; secure; HttpOnly; SameSite=None; Partitioned', 'Set-Cookie: mytestcookie=value; path=/test/; secure; HttpOnly; SameSite=None; Partitioned;', diff --git a/lib/tests/statslib_test.php b/lib/tests/statslib_test.php index 958f0e5e96b..df0441f16b7 100644 --- a/lib/tests/statslib_test.php +++ b/lib/tests/statslib_test.php @@ -213,13 +213,13 @@ final class statslib_test extends \advanced_testcase { [ "startwday" => 0, "timezone" => 'America/Chicago', - "date" => '25-03-2017 22:00', + "timestart" => '25-03-2017 22:00', "expected" => '19-03-2017 00:00:00' ], [ "startwday" => 1, "timezone" => 'Atlantic/Canary', - "date" => '06-08-2018 22:00', + "timestart" => '06-08-2018 22:00', "expected" => '06-08-2018 00:00:00' ], ]; diff --git a/lib/tests/task/hide_ended_courses_task_test.php b/lib/tests/task/hide_ended_courses_task_test.php index 81c91796826..29df3932cd8 100644 --- a/lib/tests/task/hide_ended_courses_task_test.php +++ b/lib/tests/task/hide_ended_courses_task_test.php @@ -32,7 +32,7 @@ final class hide_ended_courses_task_test extends courses_tasks_testcase { /** * Test hide_ended_courses cron task. * - * @dataProvider get_courses_provider + * @dataProvider hide_end_courses_provider * @covers ::execute * * @param int $nextweekvisible Number of courses with the end date set to next week to be created. @@ -113,4 +113,23 @@ final class hide_ended_courses_task_test extends courses_tasks_testcase { $this->assertArrayHasKey($event->courseid, array_flip($expected)); } } + + /** + * Data provider for test_hide_ended_courses. + * + * @return array + */ + public static function hide_end_courses_provider(): array { + return array_map( + function ($args): array { + return [ + 'nextweekvisible' => $args['lastweekcount'], + 'yesterdayvisible' => $args['yesterdaycount'], + 'tomorrowvisible' => $args['tomorrowcount'], + 'createhidden' => $args['createvisible'] ?? true, + ]; + }, + self::get_courses_provider() + ); + } } diff --git a/lib/tests/task/scheduled_task_test.php b/lib/tests/task/scheduled_task_test.php index a88842fa4b7..876c62c610b 100644 --- a/lib/tests/task/scheduled_task_test.php +++ b/lib/tests/task/scheduled_task_test.php @@ -709,7 +709,7 @@ final class scheduled_task_test extends \advanced_testcase { public static function provider_schedule_overrides(): array { return array( array( - 'scheduled_tasks' => array( + 'overrides' => array( '\core\task\scheduled_test_task' => array( 'schedule' => '10 13 1 2 4', 'disabled' => 0, @@ -719,7 +719,7 @@ final class scheduled_task_test extends \advanced_testcase { 'disabled' => 1, ), ), - 'task_full_classnames' => array( + 'tasks' => array( '\core\task\scheduled_test_task', '\core\task\scheduled_test2_task', ), @@ -743,13 +743,13 @@ final class scheduled_task_test extends \advanced_testcase { ) ), array( - 'scheduled_tasks' => array( + 'overrides' => array( '\core\task\*' => array( 'schedule' => '1 2 3 4 5', 'disabled' => 0, ) ), - 'task_full_classnames' => array( + 'tasks' => array( '\core\task\scheduled_test_task', '\core\task\scheduled_test2_task', ), diff --git a/lib/tests/task/show_started_courses_task_test.php b/lib/tests/task/show_started_courses_task_test.php index 168e1772aeb..6723b86615a 100644 --- a/lib/tests/task/show_started_courses_task_test.php +++ b/lib/tests/task/show_started_courses_task_test.php @@ -35,15 +35,15 @@ final class show_started_courses_task_test extends courses_tasks_testcase { * @dataProvider get_courses_provider * @covers ::execute * - * @param int $lastweekhidden Number of courses with the start date set to last week to be created. - * @param int $yesterdayhidden Number of courses with the start date set to yesterday to be created. - * @param int $tomorrowhidden Number of courses with the start date set to tomorrow to be created. + * @param int $lastweek Number of courses with the start date set to last week to be created. + * @param int $yesterday Number of courses with the start date set to yesterday to be created. + * @param int $tomorrow Number of courses with the start date set to tomorrow to be created. * @param bool $createvisible Whether visible courses should be created or not. */ public function test_show_started_courses( - int $lastweekhidden, - int $yesterdayhidden, - int $tomorrowhidden, + int $lastweekcount, + int $yesterdaycount, + int $tomorrowcount, bool $createvisible = true ): void { global $DB; @@ -61,15 +61,15 @@ final class show_started_courses_task_test extends courses_tasks_testcase { $tomorrow = $now + DAYSECS; // Hidden course that started last week. - for ($i = 0; $i < $lastweekhidden; $i++) { + for ($i = 0; $i < $lastweekcount; $i++) { $generator->create_course(['visible' => false, 'startdate' => $lastweek]); } // Hidden course that started yesterday. - for ($i = 0; $i < $yesterdayhidden; $i++) { + for ($i = 0; $i < $yesterdaycount; $i++) { $hiddencourses[] = $generator->create_course(['visible' => false, 'startdate' => $yesterday])->id; } // Hidden course that hasn't started yet. - for ($i = 0; $i < $tomorrowhidden; $i++) { + for ($i = 0; $i < $tomorrowcount; $i++) { $generator->create_course(['visible' => false, 'startdate' => $tomorrow]); } if ($createvisible) { @@ -79,7 +79,7 @@ final class show_started_courses_task_test extends courses_tasks_testcase { $visiblecourses[] = $generator->create_course(['visible' => true, 'startdate' => $tomorrow])->id; } $visibletotal = count($visiblecourses) + 1; - $coursetotal = $visibletotal + $lastweekhidden + $yesterdayhidden + $tomorrowhidden; + $coursetotal = $visibletotal + $lastweekcount + $yesterdaycount + $tomorrowcount; // Check current courses have been created correctly. $this->assertEquals($coursetotal, $DB->count_records('course')); @@ -96,14 +96,14 @@ final class show_started_courses_task_test extends courses_tasks_testcase { // Confirm the courses with yesterday as starting date are visible too. The rest should remain hidden. $this->assertEquals($coursetotal, $DB->count_records('course')); $courses = $DB->get_records('course', ['visible' => 1], '', 'id'); - $this->assertCount($visibletotal + $yesterdayhidden, $courses); + $this->assertCount($visibletotal + $yesterdaycount, $courses); $expected = array_merge($hiddencourses, $visiblecourses); $this->assertEquals(asort($expected), asort($courses)); // Check the started course event has been raised. $events = $sink->get_events(); $sink->close(); - $this->assertCount($yesterdayhidden, $events); + $this->assertCount($yesterdaycount, $events); foreach ($events as $event) { $this->assertInstanceOf('\\core\\event\\course_started', $event); $this->assertArrayHasKey($event->courseid, array_flip($expected)); diff --git a/lib/tests/user_test.php b/lib/tests/user_test.php index 5230bbfab6d..90d67747081 100644 --- a/lib/tests/user_test.php +++ b/lib/tests/user_test.php @@ -977,33 +977,33 @@ final class user_test extends \advanced_testcase { public static function user_name_provider(): array { return [ 'simple user' => [ - 'user' => ['firstname' => 'first', 'lastname' => 'last'], - 'fullnamedisplay' => 'language', + 'userdata' => ['firstname' => 'first', 'lastname' => 'last'], + 'fullnameconfig' => 'language', 'expected' => 'fl', ], 'simple user with lastname firstname in language settings' => [ - 'user' => ['firstname' => 'first', 'lastname' => 'last'], - 'fullnamedisplay' => 'lastname firstname', + 'userdata' => ['firstname' => 'first', 'lastname' => 'last'], + 'fullnameconfig' => 'lastname firstname', 'expected' => 'lf', ], 'simple user with no surname' => [ - 'user' => ['firstname' => '', 'lastname' => 'L'], - 'fullnamedisplay' => 'language', + 'userdata' => ['firstname' => '', 'lastname' => 'L'], + 'fullnameconfig' => 'language', 'expected' => 'L', ], 'simple user with a middle name' => [ - 'user' => ['firstname' => 'f', 'lastname' => 'l', 'middlename' => 'm'], - 'fullnamedisplay' => 'middlename lastname', + 'userdata' => ['firstname' => 'f', 'lastname' => 'l', 'middlename' => 'm'], + 'fullnameconfig' => 'middlename lastname', 'expected' => 'ml', ], 'user with a middle name & fullnamedisplay contains 3 names' => [ - 'user' => ['firstname' => 'first', 'lastname' => 'last', 'middlename' => 'middle'], - 'fullnamedisplay' => 'firstname middlename lastname', + 'userdata' => ['firstname' => 'first', 'lastname' => 'last', 'middlename' => 'middle'], + 'fullnameconfig' => 'firstname middlename lastname', 'expected' => 'fl', ], 'simple user with a namefield consisting of one element' => [ - 'user' => ['firstname' => 'first', 'lastname' => 'last'], - 'fullnamedisplay' => 'lastname', + 'userdata' => ['firstname' => 'first', 'lastname' => 'last'], + 'fullnameconfig' => 'lastname', 'expected' => 'l', ], ]; diff --git a/lib/xapi/tests/external/delete_states_test.php b/lib/xapi/tests/external/delete_states_test.php index 24f94d13e27..316c80c8c49 100644 --- a/lib/xapi/tests/external/delete_states_test.php +++ b/lib/xapi/tests/external/delete_states_test.php @@ -189,7 +189,8 @@ final class delete_states_test extends externallib_advanced_testcase { * @param array $expectedstates * @return void */ - public function test_delete_states(string $testedusername, + public function test_delete_states( + string $testedusername, string $testedcomponent, string $testedactivityname, array $states, @@ -267,9 +268,9 @@ final class delete_states_test extends externallib_advanced_testcase { public static function states_provider(): array { return [ 'Activities with different users and components' => [ - 'username' => 'user1', - 'component' => 'mod_h5pactivity', - 'activity' => 'Activity 1', + 'testedusername' => 'user1', + 'testedcomponent' => 'mod_h5pactivity', + 'testedactivityname' => 'Activity 1', 'states' => [ [ 'user' => 'user1', @@ -293,15 +294,15 @@ final class delete_states_test extends externallib_advanced_testcase { 'component' => 'mod_h5pactivity' ], ], - 'expectedstatesleft' => [ + 'expectedstates' => [ ['user' => 'user2', 'activity' => 'Activity 1'], ['user' => 'user1', 'activity' => 'Activity 3'] ] ], 'Activities with one single user' => [ - 'username' => 'user1', - 'component' => 'mod_h5pactivity', - 'activity' => 'Activity 1', + 'testedusername' => 'user1', + 'testedcomponent' => 'mod_h5pactivity', + 'testedactivityname' => 'Activity 1', 'states' => [ [ 'user' => 'user1', @@ -319,7 +320,7 @@ final class delete_states_test extends externallib_advanced_testcase { 'component' => 'mod_h5pactivity' ], ], - 'expectedstatesleft' => [] + 'expectedstates' => [] ], ]; } diff --git a/message/tests/api_test.php b/message/tests/api_test.php index d1d3bf80610..6a43096112f 100644 --- a/message/tests/api_test.php +++ b/message/tests/api_test.php @@ -1938,14 +1938,14 @@ final class api_test extends \advanced_testcase { public static function get_conversations_mixed_provider(): array { return [ 'Test that conversations with messages contacts is correctly ordered.' => [ - 'users' => [ + 'usersdata' => [ 'user1', 'user2', 'user3', ], 'contacts' => [ ], - 'messages' => [ + 'messagesdata' => [ [ 'from' => 'user1', 'to' => 'user2', @@ -2025,13 +2025,13 @@ final class api_test extends \advanced_testcase { ], ], 'Test conversations with a single user, where some messages are read and some are not.' => [ - 'users' => [ + 'usersdata' => [ 'user1', 'user2', ], 'contacts' => [ ], - 'messages' => [ + 'messagesdata' => [ [ 'from' => 'user1', 'to' => 'user2', @@ -2084,13 +2084,13 @@ final class api_test extends \advanced_testcase { 'are out of order' => [ // This can happen through a combination of factors including multi-master DB replication with messages // read somehow (e.g. API). - 'users' => [ + 'usersdata' => [ 'user1', 'user2', ], 'contacts' => [ ], - 'messages' => [ + 'messagesdata' => [ [ 'from' => 'user1', 'to' => 'user2', @@ -2139,13 +2139,13 @@ final class api_test extends \advanced_testcase { ], ], 'Test unread message count is correct for both users' => [ - 'users' => [ + 'usersdata' => [ 'user1', 'user2', ], 'contacts' => [ ], - 'messages' => [ + 'messagesdata' => [ [ 'from' => 'user1', 'to' => 'user2', @@ -5807,7 +5807,7 @@ final class api_test extends \advanced_testcase { return [ 'No conversations' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user5], @@ -5830,7 +5830,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'No individual conversations, 2 group conversations' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user4], @@ -5853,7 +5853,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], '2 individual conversations (one favourited), 1 group conversation' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user1], @@ -5876,7 +5876,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], '1 individual conversation, 2 group conversations' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user2], @@ -5899,7 +5899,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], '2 group conversations only' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user4], @@ -5922,7 +5922,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'All conversation types, delete a message from individual favourited, messages remaining' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [0], 'arguments' => [$user1], @@ -5945,7 +5945,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'All conversation types, delete a message from individual non-favourited, messages remaining' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [3], 'arguments' => [$user1], @@ -5968,7 +5968,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'All conversation types, delete all messages from individual favourited, no messages remaining' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [0, 1, 2], 'arguments' => [$user1], @@ -5991,7 +5991,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'All conversation types, delete all messages from individual non-favourited, no messages remaining' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [3, 4, 5], 'arguments' => [$user1], @@ -6014,7 +6014,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'All conversation types, delete all messages from individual favourited, no messages remaining, different user' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [0, 1, 2], 'arguments' => [$user2], @@ -6037,7 +6037,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'All conversation types, delete all messages from individual non-favourited, no messages remaining, different user' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [3, 4, 5], 'arguments' => [$user3], @@ -6060,7 +6060,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'All conversation types, delete some messages from group non-favourited, messages remaining,' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [6, 7], 'arguments' => [$user1], @@ -6083,7 +6083,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'All conversation types, delete all messages from group non-favourited, no messages remaining,' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [6, 7, 8, 9], 'arguments' => [$user1], @@ -6106,7 +6106,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'All conversation types, another user soft deleted' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user1], @@ -6129,7 +6129,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [$user2], ], 'All conversation types, all group users soft deleted' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user1], @@ -6152,7 +6152,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [$user2, $user3, $user4], ], 'Group conversation which is disabled, favourited' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user6], @@ -6175,7 +6175,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'Group conversation which is disabled, non-favourited' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user7], @@ -6198,7 +6198,7 @@ final class api_test extends \advanced_testcase { 'deletedusers' => [], ], 'Conversation with self' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user8], diff --git a/message/tests/externallib_test.php b/message/tests/externallib_test.php index c4d61aaf1f5..e144549814c 100644 --- a/message/tests/externallib_test.php +++ b/message/tests/externallib_test.php @@ -5191,7 +5191,7 @@ final class externallib_test extends externallib_advanced_testcase { return [ 'No conversations' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user5], @@ -5208,7 +5208,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'No individual conversations, 2 group conversations' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user4], @@ -5225,7 +5225,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], '2 individual conversations (one favourited), 1 group conversation' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user1], @@ -5242,7 +5242,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], '1 individual conversation, 2 group conversations' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user2], @@ -5259,7 +5259,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], '2 group conversations only' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user4], @@ -5276,7 +5276,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'All conversation types, delete a message from individual favourited, messages remaining' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [0], 'arguments' => [$user1], @@ -5293,7 +5293,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'All conversation types, delete a message from individual non-favourited, messages remaining' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [3], 'arguments' => [$user1], @@ -5310,7 +5310,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'All conversation types, delete all messages from individual favourited, no messages remaining' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [0, 1, 2], 'arguments' => [$user1], @@ -5327,7 +5327,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'All conversation types, delete all messages from individual non-favourited, no messages remaining' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [3, 4, 5], 'arguments' => [$user1], @@ -5344,7 +5344,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'All conversation types, delete all messages from individual favourited, no messages remaining, different user' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [0, 1, 2], 'arguments' => [$user2], @@ -5361,7 +5361,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'All conversation types, delete all messages from individual non-favourited, no messages remaining, different user' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [3, 4, 5], 'arguments' => [$user3], @@ -5378,7 +5378,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'All conversation types, delete some messages from group non-favourited, messages remaining,' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [6, 7], 'arguments' => [$user1], @@ -5395,7 +5395,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'All conversation types, delete all messages from group non-favourited, no messages remaining,' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => $user1, 'deletemessages' => [6, 7, 8, 9], 'arguments' => [$user1], @@ -5412,7 +5412,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'All conversation types, another user soft deleted' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user1], @@ -5429,7 +5429,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [$user2] ], 'All conversation types, all group users soft deleted' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user1], @@ -5446,7 +5446,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [$user2, $user3, $user4] ], 'Group conversation which is disabled, favourited' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user6], @@ -5463,7 +5463,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'Group conversation which is disabled, non-favourited' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user7], @@ -5480,7 +5480,7 @@ final class externallib_test extends externallib_advanced_testcase { 'deletedusers' => [] ], 'Conversation with self' => [ - 'conversationConfigs' => $conversations, + 'conversationconfigs' => $conversations, 'deletemessagesuser' => null, 'deletemessages' => [], 'arguments' => [$user8], diff --git a/mod/bigbluebuttonbn/tests/instance_test.php b/mod/bigbluebuttonbn/tests/instance_test.php index 143f63949b8..9b9e54c3166 100644 --- a/mod/bigbluebuttonbn/tests/instance_test.php +++ b/mod/bigbluebuttonbn/tests/instance_test.php @@ -373,7 +373,7 @@ final class instance_test extends advanced_testcase { */ public function test_user_must_wait_to_join(bool $isadmin, bool $ismoderator, bool $haswaitingroom, bool $expected): void { $stub = $this->getMockBuilder(instance::class) - ->setMethods([ + ->onlyMethods([ 'get_instance_var', 'is_admin', 'is_moderator', @@ -419,7 +419,7 @@ final class instance_test extends advanced_testcase { bool $expected ): void { $stub = $this->getMockBuilder(instance::class) - ->setMethods([ + ->onlyMethods([ 'is_admin', 'is_moderator', ]) @@ -456,7 +456,7 @@ final class instance_test extends advanced_testcase { */ public function test_get_current_user_password(bool $isadmin, bool $ismoderator, bool $expectedmodpassword): void { $stub = $this->getMockBuilder(instance::class) - ->setMethods([ + ->onlyMethods([ 'is_admin', 'is_moderator', 'get_moderator_password', @@ -501,7 +501,7 @@ final class instance_test extends advanced_testcase { */ public function test_get_current_user_role(bool $isadmin, bool $ismoderator, bool $expectedmodrole): void { $stub = $this->getMockBuilder(instance::class) - ->setMethods([ + ->onlyMethods([ 'is_admin', 'is_moderator', ]) @@ -546,7 +546,7 @@ final class instance_test extends advanced_testcase { bool $expected ): void { $stub = $this->getMockBuilder(instance::class) - ->setMethods([ + ->onlyMethods([ 'is_recorded', 'should_show_recording_button', ]) diff --git a/mod/bigbluebuttonbn/tests/local/extension_test.php b/mod/bigbluebuttonbn/tests/local/extension_test.php index 01db8ec3f4e..1ea72da4fc6 100644 --- a/mod/bigbluebuttonbn/tests/local/extension_test.php +++ b/mod/bigbluebuttonbn/tests/local/extension_test.php @@ -428,12 +428,12 @@ final class extension_test extends \advanced_testcase { 'mod_instance_helper with plugin disabled' => [ 'bbbenabled' => false, 'apiclass' => mod_instance_helper::class, - 'result' => [], + 'extensionclasses' => [], ], 'mod_instance_helper with plugin enabled' => [ 'bbbenabled' => true, 'apiclass' => mod_instance_helper::class, - 'result' => [ + 'extensionclasses' => [ 'bbbext_simple\\bigbluebuttonbn\\mod_instance_helper', ], ], diff --git a/mod/bigbluebuttonbn/tests/meeting_test.php b/mod/bigbluebuttonbn/tests/meeting_test.php index 0560e2d661c..7b66fbd6831 100644 --- a/mod/bigbluebuttonbn/tests/meeting_test.php +++ b/mod/bigbluebuttonbn/tests/meeting_test.php @@ -120,7 +120,7 @@ final class meeting_test extends \advanced_testcase { * @covers ::create_meeting_data * @covers ::create_meeting_metadata */ - public function test_create_meeting(int $type, ?string $groupname): void { + public function test_create_meeting(int $type, ?string $groupname, $groupmode, $canjoin): void { $this->resetAfterTest(); [$meeting, $useringroup, $usernotingroup, $groupid, $activity] = $this->prepare_meeting($type, $groupname, SEPARATEGROUPS, false); @@ -142,7 +142,7 @@ final class meeting_test extends \advanced_testcase { * @covers ::get_meeting_info * @covers ::do_get_meeting_info */ - public function test_get_meeting_info(int $type, ?string $groupname): void { + public function test_get_meeting_info(int $type, ?string $groupname, $groupmode, $canjoin): void { $this->resetAfterTest(); [$meeting, $useringroup, $usernotingroup, $groupid, $activity] = $this->prepare_meeting($type, $groupname); $meetinginfo = $meeting->get_meeting_info(); diff --git a/mod/data/tests/manager_test.php b/mod/data/tests/manager_test.php index 4404f50b54f..0e2461c424e 100644 --- a/mod/data/tests/manager_test.php +++ b/mod/data/tests/manager_test.php @@ -741,31 +741,31 @@ final class manager_test extends \advanced_testcase { return [ // User presets. 'listtemplate' => [ - 'templatename' => 'listtemplate', + 'templatetoreset' => 'listtemplate', 'expected' => ['listtemplate', 'listtemplateheader', 'listtemplatefooter'], ], 'singletemplate' => [ - 'templatename' => 'singletemplate', + 'templatetoreset' => 'singletemplate', 'expected' => ['singletemplate'], ], 'asearchtemplate' => [ - 'templatename' => 'asearchtemplate', + 'templatetoreset' => 'asearchtemplate', 'expected' => ['asearchtemplate'], ], 'addtemplate' => [ - 'templatename' => 'addtemplate', + 'templatetoreset' => 'addtemplate', 'expected' => ['addtemplate'], ], 'rsstemplate' => [ - 'templatename' => 'rsstemplate', + 'templatetoreset' => 'rsstemplate', 'expected' => ['rsstemplate', 'rsstitletemplate'], ], 'csstemplate' => [ - 'templatename' => 'csstemplate', + 'templatetoreset' => 'csstemplate', 'expected' => ['csstemplate'], ], 'jstemplate' => [ - 'templatename' => 'jstemplate', + 'templatetoreset' => 'jstemplate', 'expected' => ['jstemplate'], ], ]; diff --git a/mod/data/tests/preset_importer_test.php b/mod/data/tests/preset_importer_test.php index 6c91685d39a..33d4fbd26ac 100644 --- a/mod/data/tests/preset_importer_test.php +++ b/mod/data/tests/preset_importer_test.php @@ -109,14 +109,14 @@ final class preset_importer_test extends \advanced_testcase { public static function needs_mapping_provider(): array { $basedprovider = static::preset_importer_provider(); - $basedprovider['Empty database / Empty importer']['needsmapping'] = false; - $basedprovider['Empty database / Importer with fields']['needsmapping'] = false; - $basedprovider['Database with fields / Empty importer']['needsmapping'] = true; - $basedprovider['Same fields']['needsmapping'] = false; - $basedprovider['Fields to create']['needsmapping'] = true; - $basedprovider['Fields to remove']['needsmapping'] = true; - $basedprovider['Fields to update']['needsmapping'] = true; - $basedprovider['Fields to create, remove and update']['needsmapping'] = true; + $basedprovider['Empty database / Empty importer']['expectedresult'] = false; + $basedprovider['Empty database / Importer with fields']['expectedresult'] = false; + $basedprovider['Database with fields / Empty importer']['expectedresult'] = true; + $basedprovider['Same fields']['expectedresult'] = false; + $basedprovider['Fields to create']['expectedresult'] = true; + $basedprovider['Fields to remove']['expectedresult'] = true; + $basedprovider['Fields to update']['expectedresult'] = true; + $basedprovider['Fields to create, remove and update']['expectedresult'] = true; return $basedprovider; } @@ -304,6 +304,7 @@ final class preset_importer_test extends \advanced_testcase { ): void { global $USER; + // xdebug_break(); $this->resetAfterTest(); $this->setAdminUser(); $plugingenerator = $this->getDataGenerator()->get_plugin_generator('mod_data'); diff --git a/mod/h5pactivity/tests/output/result/result_test.php b/mod/h5pactivity/tests/output/result/result_test.php index 1de69263189..303a66c2747 100644 --- a/mod/h5pactivity/tests/output/result/result_test.php +++ b/mod/h5pactivity/tests/output/result/result_test.php @@ -36,7 +36,7 @@ final class result_test extends \advanced_testcase { public static function result_data_provider(): array { return [ 'fill-in with case sensitive' => [ - 'result' => [ + 'providedresultdata' => [ 'interactiontype' => 'fill-in', 'description' => '

Fill in the missing words

Meow .... this is a __________

@@ -47,13 +47,13 @@ final class result_test extends \advanced_testcase { . '"https:\\/\\/h5p.org\\/x-api\\/case-sensitivity":true,' . '"https:\\/\\/h5p.org\\/x-api\\/alternatives":[["cat"],["dog"]]},"contextExtensions":{}}', ], - 'useranswers' => [ + 'expecteduseranswers' => [ 'Gap #1 - cat' => (object) ['answer' => 'Cat', 'incorrect' => true], 'Gap #2 - dog' => (object) ['answer' => 'dog', 'correct' => true], ], ], 'fill-in with case insensitive' => [ - 'result' => [ + 'providedresultdata' => [ 'interactiontype' => 'fill-in', 'description' => '

Fill in the missing words

Meow .... this is a __________

@@ -64,13 +64,13 @@ final class result_test extends \advanced_testcase { . '"https:\\/\\/h5p.org\\/x-api\\/case-sensitivity":false,' . '"https:\\/\\/h5p.org\\/x-api\\/alternatives":[["cat"],["dog"]]},"contextExtensions":{}}', ], - 'useranswers' => [ + 'expecteduseranswers' => [ 'Gap #1 - cat' => (object) ['answer' => 'Cat', 'correct' => true], 'Gap #2 - dog' => (object) ['answer' => 'dog', 'correct' => true], ], ], 'drag and drop' => [ - 'result' => [ + 'providedresultdata' => [ 'interactiontype' => 'matching', 'description' => 'Drag and Drop Test', 'correctpattern' => '["0[.]0[,]0[.]2[,]1[.]1[,]1[.]0"]', @@ -85,7 +85,7 @@ final class result_test extends \advanced_testcase { . '"http:\/\/h5p.org\/x-api\/h5p-subContentId":"59590246-f16e-4855-8dd6-c80e892ef96b"},' . '"contextExtensions":{}}', ], - 'useranswers' => [ + 'expecteduseranswers' => [ 'Answer 1 (DZ1 and DZ2) - Dropzone 1, Dropzone 2' => (object) ['answer' => 'Dropzone 1', 'correct' => true], 'Anwser 2 (DZ2) - Dropzone 2' => (object) ['answer' => 'Dropzone 2', 'correct' => true], 'Anwser 3 (DZ1) - Dropzone 1' => (object) ['answer' => 'Dropzone 1', 'correct' => true], @@ -93,7 +93,7 @@ final class result_test extends \advanced_testcase { ], ], 'drag and drop with no answer' => [ - 'result' => [ + 'providedresultdata' => [ 'interactiontype' => 'matching', 'description' => 'Drag and Drop Test', 'correctpattern' => '["0[.]0[,]0[.]2[,]1[.]1[,]1[.]0"]', @@ -108,7 +108,7 @@ final class result_test extends \advanced_testcase { . '"http:\/\/h5p.org\/x-api\/h5p-subContentId":"59590246-f16e-4855-8dd6-c80e892ef96b"},' . '"contextExtensions":{}}', ], - 'useranswers' => [ + 'expecteduseranswers' => [ 'Answer 1 (DZ1 and DZ2) - Dropzone 1, Dropzone 2' => (object) ['answer' => 'Dropzone 2', 'correct' => true], 'Anwser 2 (DZ2) - Dropzone 2' => (object) ['answer' => 'Dropzone 2', 'correct' => true], 'Anwser 3 (DZ1) - Dropzone 1' => (object) ['answer' => 'None', 'incorrect' => true], @@ -116,7 +116,7 @@ final class result_test extends \advanced_testcase { ], ], 'sort the paragraph text' => [ - 'result' => [ + 'providedresultdata' => [ 'interactiontype' => 'sequencing', 'description' => 'SortParagraphs', 'correctpattern' => '["0[,]1[,]2[,]3[,]4"]', @@ -131,7 +131,7 @@ final class result_test extends \advanced_testcase { '"extensions":{"http:\\/\\/h5p.org\\/x-api\\/h5p-local-content-id":39,' . '"https:\\/\\/h5p.org\\/x-api\\/duplicates-interchangeable":1},"contextExtensions":{}}', ], - 'useranswers' => [ + 'expecteduseranswers' => [ '#1 - First I wake up at 7.30 am' => (object) ['answer' => 'Correct answer', 'pass' => true], '#2 - Next I get dressed' => (object) ['answer' => 'Correct answer', 'pass' => true], '#3 - Afterward I have breakfast' => (object) ['answer' => 'Incorrect answer', 'fail' => true], @@ -140,7 +140,7 @@ final class result_test extends \advanced_testcase { ], ], 'sequencing images' => [ - 'result' => [ + 'providedresultdata' => [ 'interactiontype' => 'sequencing', 'description' => 'Order the planets from smallest to largest', 'correctpattern' => '["item_3[,]item_0[,]item_7[,]item_1[,]item_5[,]item_2[,]item_4[,]item_6"]', @@ -152,7 +152,7 @@ final class result_test extends \advanced_testcase { . '{"id":"item_6","description":{"en-US":"Jupiter"}}],"extensions":' . '{"http:\/\/h5p.org\/x-api\/h5p-local-content-id":43},"contextExtensions":{}}', ], - 'useranswers' => [ + 'expecteduseranswers' => [ '#1 - Mercury' => (object) ['answer' => 'Correct answer', 'pass' => true], '#2 - Mars' => (object) ['answer' => 'Correct answer', 'pass' => true], '#3 - Earth' => (object) ['answer' => 'Incorrect answer', 'fail' => true], diff --git a/mod/label/tests/lib_test.php b/mod/label/tests/lib_test.php index a8dc1d67d0a..b73d16743ef 100644 --- a/mod/label/tests/lib_test.php +++ b/mod/label/tests/lib_test.php @@ -241,19 +241,19 @@ final class lib_test extends \advanced_testcase { 'name' => 'Test label 1', 'content' => '

Simple textual content

', 'format' => FORMAT_HTML, - 'expected' => 'Test label 1' + 'expectedname' => 'Test label 1' ], 'simple' => [ 'name' => '', 'content' => '

Simple textual content

', 'format' => FORMAT_HTML, - 'expected' => 'Simple textual content' + 'expectedname' => 'Simple textual content' ], 'empty' => [ 'name' => '', 'content' => '', 'format' => FORMAT_HTML, - 'expected' => 'Test label 1' + 'expectedname' => 'Test label 1' ], 'withaudiocontent' => [ 'name' => '', @@ -263,7 +263,7 @@ final class lib_test extends \advanced_testcase { @@PLUGINFILE@@/moodle-hit-song.mp3  

', 'format' => FORMAT_HTML, - 'expected' => 'Test with audio' + 'expectedname' => 'Test with audio' ], 'withvideo' => [ 'name' => '', @@ -273,7 +273,7 @@ final class lib_test extends \advanced_testcase { https://www.youtube.com/watch?v=xxxyy  

', 'format' => FORMAT_HTML, - 'expected' => 'Test video https://www.youtube.com/watch?v=xxxyy' + 'expectedname' => 'Test video https://www.youtube.com/watch?v=xxxyy' ], 'with video trimming' => [ 'name' => '', @@ -283,61 +283,61 @@ final class lib_test extends \advanced_testcase { https://www.youtube.com/watch?v=xxxyy  

', 'format' => FORMAT_HTML, - 'expected' => 'Test with video to be trimmed https://www.youtube....' + 'expectedname' => 'Test with video to be trimmed https://www.youtube....' ], 'with plain text' => [ 'name' => '', 'content' => 'Content with @@PLUGINFILE@@/moodle-hit-song.mp3 nothing', 'format' => FORMAT_HTML, - 'expected' => 'Content with nothing' + 'expectedname' => 'Content with nothing' ], 'with several spaces' => [ 'name' => '', 'content' => "Content with @@PLUGINFILE@@/moodle-hit-song.mp3 \r   several spaces", 'format' => FORMAT_HTML, - 'expected' => 'Content with several spaces' + 'expectedname' => 'Content with several spaces' ], 'empty spaces' => [ 'name' => '', 'content' => '   ', 'format' => FORMAT_HTML, - 'expected' => 'Text and media area' + 'expectedname' => 'Text and media area' ], 'only html' => [ 'name' => '', 'content' => '', 'format' => FORMAT_HTML, - 'expected' => 'Text and media area' + 'expectedname' => 'Text and media area' ], 'markdown' => [ 'name' => '', 'content' => "##Simple Title\n simple markdown format", 'format' => FORMAT_MARKDOWN, - 'expected' => 'Simple Title simple markdown format' + 'expectedname' => 'Simple Title simple markdown format' ], 'markdown with pluginfile' => [ 'name' => '', 'content' => "##Simple Title\n simple markdown format @@PLUGINFILE@@/moodle-hit-song.mp3", 'format' => FORMAT_MARKDOWN, - 'expected' => 'Simple Title simple markdown format' + 'expectedname' => 'Simple Title simple markdown format' ], 'plain text' => [ 'name' => '', 'content' => "Simple plain text @@PLUGINFILE@@/moodle-hit-song.mp3", 'format' => FORMAT_PLAIN, - 'expected' => 'Simple plain text' + 'expectedname' => 'Simple plain text' ], 'moodle format text' => [ 'name' => '', 'content' => "Simple plain text @@PLUGINFILE@@/moodle-hit-song.mp3", 'format' => FORMAT_MOODLE, - 'expected' => 'Simple plain text' + 'expectedname' => 'Simple plain text' ], 'html format text' => [ 'name' => '', 'content' => "

Simple plain title

with plain text

@@PLUGINFILE@@/moodle-hit-song.mp3", 'format' => FORMAT_HTML, - 'expected' => 'Simple plain title with plain text' + 'expectedname' => 'Simple plain title with plain text' ], ]; } diff --git a/mod/lesson/tests/numeric_helper_test.php b/mod/lesson/tests/numeric_helper_test.php index b02b3330b4b..81238924300 100644 --- a/mod/lesson/tests/numeric_helper_test.php +++ b/mod/lesson/tests/numeric_helper_test.php @@ -66,7 +66,7 @@ final class numeric_helper_test extends \advanced_testcase { return [ "Using a decimal as a separator" => [ "decsep" => ".", - "test" => [ + "tests" => [ ["2.1", 2.1], ["1:4.2", "1:4.2"], ["2,1", 2], @@ -76,7 +76,7 @@ final class numeric_helper_test extends \advanced_testcase { ], "Using a comma as a separator" => [ "decsep" => ",", - "test" => [ + "tests" => [ ["2,1", 2.1], ["1:4,2", "1:4.2"], ["2.1", 2.1], @@ -85,7 +85,7 @@ final class numeric_helper_test extends \advanced_testcase { ], "Using a X as a separator" => [ "decsep" => "X", - "test" => [ + "tests" => [ ["2X1", 2.1], ["1:4X2", "1:4.2"], ["2.1", 2.1], @@ -104,7 +104,7 @@ final class numeric_helper_test extends \advanced_testcase { return [ "Using a decimal as a separator" => [ "decsep" => ".", - "test" => [ + "tests" => [ ["2.1", 2.1], ["1:4.2", "1:4.2"], ["2,1", "2,1"], @@ -113,7 +113,7 @@ final class numeric_helper_test extends \advanced_testcase { ], "Using a comma as a separator" => [ "decsep" => ",", - "test" => [ + "tests" => [ ["2,1", "2,1"], ["1:4,2", "1:4,2"], ["2.1", "2,1"], @@ -123,7 +123,7 @@ final class numeric_helper_test extends \advanced_testcase { ], "Using a X as a separator" => [ "decsep" => "X", - "test" => [ + "tests" => [ ["2X1", "2X1"], ["1:4X2", "1:4X2"], ["2.1", "2X1"], diff --git a/mod/lti/tests/local/ltiopenid/registration_test.php b/mod/lti/tests/local/ltiopenid/registration_test.php index 8de595c27a1..798b291dda8 100644 --- a/mod/lti/tests/local/ltiopenid/registration_test.php +++ b/mod/lti/tests/local/ltiopenid/registration_test.php @@ -407,7 +407,7 @@ EOD; $toolproxy['secret'] = 'peM7YDx420bo'; $reghelper = $this->getMockBuilder(registration_helper::class) - ->setMethods(['get_tool_proxy']) + ->onlyMethods(['get_tool_proxy']) ->getMock(); $map = [[$toolproxy['id'], $toolproxy]]; $reghelper->method('get_tool_proxy') diff --git a/mod/quiz/accessrule/seb/tests/external/validate_quiz_access_test.php b/mod/quiz/accessrule/seb/tests/external/validate_quiz_access_test.php index bd895c75926..6fd9744ba89 100644 --- a/mod/quiz/accessrule/seb/tests/external/validate_quiz_access_test.php +++ b/mod/quiz/accessrule/seb/tests/external/validate_quiz_access_test.php @@ -60,31 +60,31 @@ final class validate_quiz_access_test extends \advanced_testcase { 'cmid' => null, 'url' => null, 'configkey' => null, - '/Invalid parameter value detected \(Missing required key in single structure: cmid\)/' + 'messageregex' => '/Invalid parameter value detected \(Missing required key in single structure: cmid\)/' ], 'no course module id' => [ 'cmid' => null, 'url' => 'https://www.example.com/moodle', 'configkey' => hash('sha256', 'configkey'), - '/Invalid parameter value detected \(Missing required key in single structure: cmid\)/' + 'messageregex' => '/Invalid parameter value detected \(Missing required key in single structure: cmid\)/' ], 'no url' => [ 'cmid' => 123, 'url' => null, 'configkey' => hash('sha256', 'configkey'), - '/Invalid parameter value detected \(Missing required key in single structure: url\)/' + 'messageregex' => '/Invalid parameter value detected \(Missing required key in single structure: url\)/' ], 'cmid is not an int' => [ 'cmid' => 'test', 'url' => 'https://www.example.com/moodle', 'configkey' => null, - '/Invalid external api parameter: the value is "test", the server was expecting "int" type/' + 'messageregex' => '/Invalid external api parameter: the value is "test", the server was expecting "int" type/' ], 'url is not a url' => [ 'cmid' => 123, 'url' => 123, 'configkey' => hash('sha256', 'configkey'), - '/Invalid external api parameter: the value is "123", the server was expecting "url" type/' + 'messageregex' => '/Invalid external api parameter: the value is "123", the server was expecting "url" type/' ], ]; } diff --git a/mod/quiz/tests/local/override_manager_test.php b/mod/quiz/tests/local/override_manager_test.php index 83b8fcfe187..5376d2ba045 100644 --- a/mod/quiz/tests/local/override_manager_test.php +++ b/mod/quiz/tests/local/override_manager_test.php @@ -225,7 +225,7 @@ final class override_manager_test extends \advanced_testcase { 'password' => 'test', ], 'expectedrecordscreated' => 1, - 'expectedevent' => user_override_created::class, + 'expectedeventclass' => user_override_created::class, ], 'create user override - no calendar events should be created' => [ 'existingdata' => [], @@ -239,7 +239,7 @@ final class override_manager_test extends \advanced_testcase { 'password' => 'test', ], 'expectedrecordscreated' => 1, - 'expectedevent' => user_override_created::class, + 'expectedeventclass' => user_override_created::class, ], 'create user override - only timeopen' => [ 'existingdata' => [], @@ -253,7 +253,7 @@ final class override_manager_test extends \advanced_testcase { 'password' => 'test', ], 'expectedrecordscreated' => 1, - 'expectedevent' => user_override_created::class, + 'expectedeventclass' => user_override_created::class, ], 'create group override - no existing data' => [ 'existingdata' => [], @@ -267,7 +267,7 @@ final class override_manager_test extends \advanced_testcase { 'password' => 'test', ], 'expectedrecordscreated' => 1, - 'expectedevent' => group_override_created::class, + 'expectedeventclass' => group_override_created::class, ], 'create group override - no calendar events should be created' => [ 'existingdata' => [], @@ -281,7 +281,7 @@ final class override_manager_test extends \advanced_testcase { 'password' => 'test', ], 'expectedrecordscreated' => 1, - 'expectedevent' => group_override_created::class, + 'expectedeventclass' => group_override_created::class, ], 'create group override - only timeopen' => [ 'existingdata' => [], @@ -295,7 +295,7 @@ final class override_manager_test extends \advanced_testcase { 'password' => null, ], 'expectedrecordscreated' => 1, - 'expectedevent' => group_override_created::class, + 'expectedeventclass' => group_override_created::class, ], 'update user override - updating existing data' => [ 'existingdata' => [ @@ -318,7 +318,7 @@ final class override_manager_test extends \advanced_testcase { 'password' => 'test', ], 'expectedrecordscreated' => 0, - 'expectedevent' => user_override_updated::class, + 'expectedeventclass' => user_override_updated::class, ], 'update group override - updating existing data' => [ 'existingdata' => [ @@ -341,7 +341,7 @@ final class override_manager_test extends \advanced_testcase { 'password' => 'test', ], 'expectedrecordscreated' => 0, - 'expectedevent' => group_override_updated::class, + 'expectedeventclass' => group_override_updated::class, ], 'attempts is set to unlimited (i.e. 0)' => [ 'existingdata' => [], @@ -356,7 +356,7 @@ final class override_manager_test extends \advanced_testcase { 'password' => null, ], 'expectedrecordscreated' => 1, - 'expectedevent' => user_override_created::class, + 'expectedeventclass' => user_override_created::class, ], 'some settings submitted are the same as what is in the quiz (valid)' => [ 'existingdata' => [], @@ -372,7 +372,7 @@ final class override_manager_test extends \advanced_testcase { 'password' => null, ], 'expectedrecordscreated' => 1, - 'expectedevent' => user_override_created::class, + 'expectedeventclass' => user_override_created::class, ], ]; } @@ -900,31 +900,31 @@ final class override_manager_test extends \advanced_testcase { public static function delete_override_provider(): array { return [ 'delete by id (no events logged)' => [ - 'function' => fn($manager, $override) => $manager->delete_overrides_by_id([$override->id], false, false), + 'deletefunction' => fn($manager, $override) => $manager->delete_overrides_by_id([$override->id], false, false), 'checkeventslogged' => false, ], 'delete single (no events logged)' => [ - 'function' => fn($manager, $override) => $manager->delete_overrides([$override], false, false), + 'deletefunction' => fn($manager, $override) => $manager->delete_overrides([$override], false, false), 'checkeventslogged' => false, ], 'delete all (no events logged)' => [ - 'function' => fn($manager, $override) => $manager->delete_all_overrides(false, false), + 'deletefunction' => fn($manager, $override) => $manager->delete_all_overrides(false, false), 'checkeventslogged' => false, ], 'delete by id (events logged)' => [ - 'function' => fn($manager, $override) => $manager->delete_overrides_by_id([$override->id], true, false), + 'deletefunction' => fn($manager, $override) => $manager->delete_overrides_by_id([$override->id], true, false), 'checkeventslogged' => true, ], 'delete single (events logged)' => [ - 'function' => fn($manager, $override) => $manager->delete_overrides([$override], true, false), + 'deletefunction' => fn($manager, $override) => $manager->delete_overrides([$override], true, false), 'checkeventslogged' => true, ], 'delete all (events logged)' => [ - 'function' => fn($manager, $override) => $manager->delete_all_overrides(true, false), + 'deletefunction' => fn($manager, $override) => $manager->delete_all_overrides(true, false), 'checkeventslogged' => true, ], 'delete all in database (events logged)' => [ - 'function' => fn($manager, $override) => $manager->delete_all_overrides(true, false), + 'deletefunction' => fn($manager, $override) => $manager->delete_all_overrides(true, false), 'checkeventslogged' => true, ], ]; diff --git a/mod/wiki/tests/backup/restore_format_test.php b/mod/wiki/tests/backup/restore_format_test.php index c27cc5eae58..eb057b31212 100644 --- a/mod/wiki/tests/backup/restore_format_test.php +++ b/mod/wiki/tests/backup/restore_format_test.php @@ -34,19 +34,19 @@ final class restore_format_test extends \advanced_testcase { public static function restore_format_test_provider(): array { return [ 'creole' => [ - 'data' => 'creole', + 'format' => 'creole', 'expected' => 'creole', ], 'html' => [ - 'data' => 'html', + 'format' => 'html', 'expected' => 'html', ], 'wikimarkup' => [ - 'data' => 'nwiki', + 'format' => 'nwiki', 'expected' => 'nwiki', ], 'wrong format' => [ - 'data' => '../wrongformat123', + 'format' => '../wrongformat123', 'expected' => 'wrongformat', ], ]; diff --git a/mod/wiki/tests/privacy/provider_test.php b/mod/wiki/tests/privacy/provider_test.php index 7406070fe77..0ae1e352521 100644 --- a/mod/wiki/tests/privacy/provider_test.php +++ b/mod/wiki/tests/privacy/provider_test.php @@ -252,7 +252,7 @@ final class provider_test extends provider_testcase { $this->assertEqualsCanonicalizing([ $this->contexts[1]->id, $this->contexts[2]->id, - ], $contextids); + ], array_values($contextids)); // Get contexts for the second user. $contextids = provider::get_contexts_for_userid($this->users[2]->id)->get_contextids(); @@ -260,7 +260,7 @@ final class provider_test extends provider_testcase { $this->contexts[1]->id, $this->contexts[2]->id, $this->contexts[3]->id, - ], $contextids); + ], array_values($contextids)); // Get contexts for the third user. $contextids = provider::get_contexts_for_userid($this->users[3]->id)->get_contextids(); @@ -268,7 +268,7 @@ final class provider_test extends provider_testcase { $this->contexts[1]->id, $this->contexts[2]->id, $this->contexts[3]->id, - ], $contextids); + ], array_values($contextids)); } /** diff --git a/mod/wiki/tests/wikiparser_test.php b/mod/wiki/tests/wikiparser_test.php index ead65ac1155..757476df394 100644 --- a/mod/wiki/tests/wikiparser_test.php +++ b/mod/wiki/tests/wikiparser_test.php @@ -363,19 +363,19 @@ final class wikiparser_test extends \advanced_testcase { public static function format_parser_provider(): array { return [ 'creole' => [ - 'data' => 'creole', + 'format' => 'creole', 'expected' => 'creole', ], 'html' => [ - 'data' => 'html', + 'format' => 'html', 'expected' => 'html', ], 'wikimarkup' => [ - 'data' => 'nwiki', + 'format' => 'nwiki', 'expected' => 'nwiki', ], 'wrong format' => [ - 'data' => '../wrongformat123', + 'format' => '../wrongformat123', 'expected' => 'exception', ], ]; diff --git a/mod/workshop/tests/privacy/provider_test.php b/mod/workshop/tests/privacy/provider_test.php index 49c32ac15f5..cae48d3aa46 100644 --- a/mod/workshop/tests/privacy/provider_test.php +++ b/mod/workshop/tests/privacy/provider_test.php @@ -192,19 +192,19 @@ final class provider_test extends provider_testcase { // Student1 has data in workshop11 (author + self reviewer), workshop12 (author) and workshop21 (reviewer). $contextlist = \mod_workshop\privacy\provider::get_contexts_for_userid($this->student1->id); $this->assertInstanceOf(\core_privacy\local\request\contextlist::class, $contextlist); - $this->assertEqualsCanonicalizing([$context11->id, $context12->id, $context21->id], $contextlist->get_contextids()); + $this->assertEqualsCanonicalizing([$context11->id, $context12->id, $context21->id], array_values($contextlist->get_contextids())); // Student2 has data in workshop11 (reviewer), workshop12 (reviewer) and workshop21 (author). $contextlist = \mod_workshop\privacy\provider::get_contexts_for_userid($this->student2->id); - $this->assertEqualsCanonicalizing([$context11->id, $context12->id, $context21->id], $contextlist->get_contextids()); + $this->assertEqualsCanonicalizing([$context11->id, $context12->id, $context21->id], array_values($contextlist->get_contextids())); // Student3 has data in workshop11 (reviewer). $contextlist = \mod_workshop\privacy\provider::get_contexts_for_userid($this->student3->id); - $this->assertEqualsCanonicalizing([$context11->id], $contextlist->get_contextids()); + $this->assertEqualsCanonicalizing([$context11->id], array_values($contextlist->get_contextids())); // Teacher4 has data in workshop12 (gradeoverby) and workshop21 (gradinggradeoverby). $contextlist = \mod_workshop\privacy\provider::get_contexts_for_userid($this->teacher4->id); - $this->assertEqualsCanonicalizing([$context21->id, $context12->id], $contextlist->get_contextids()); + $this->assertEqualsCanonicalizing([$context21->id, $context12->id], array_values($contextlist->get_contextids())); } /** diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 15fdf7e73ff..8f6a9febddd 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,20 @@ + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" + bootstrap="lib/phpunit/bootstrap.php" + processIsolation="false" + backupGlobals="false" + cacheResult="false" + stopOnError="false" + stopOnFailure="false" + stopOnIncomplete="false" + stopOnSkipped="false" + beStrictAboutTestsThatDoNotTestAnything="false" + beStrictAboutOutputDuringTests="true" + cacheDirectory=".phpunit.cache" + backupStaticProperties="false" +> @@ -90,11 +88,9 @@ lib/grade/tests grade/tests grade/grading/tests - grade/import/csv/tests lib/grade/tests/classes grade/tests/classes grade/grading/tests/classes - grade/import/csv/tests/classes analytics/tests @@ -305,8 +301,8 @@ - + - + diff --git a/privacy/tests/privacy/provider_test.php b/privacy/tests/privacy/provider_test.php index 5c25dfc0144..3e184aed58e 100644 --- a/privacy/tests/privacy/provider_test.php +++ b/privacy/tests/privacy/provider_test.php @@ -233,12 +233,15 @@ final class provider_test extends \advanced_testcase { * @return array */ 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 - ); - }); + return array_map( + fn ($data) => ['component' => $data['component']], + array_filter(self::get_component_list(), function($component): bool { + return static::component_implements( + $component['classname'], + \core_privacy\local\request\core_user_data_provider::class + ); + }), + ); } /** diff --git a/question/bank/comment/tests/privacy/provider_test.php b/question/bank/comment/tests/privacy/provider_test.php index 1155ff53d17..01d30d212d8 100644 --- a/question/bank/comment/tests/privacy/provider_test.php +++ b/question/bank/comment/tests/privacy/provider_test.php @@ -142,7 +142,7 @@ final class provider_test extends \core_privacy\tests\provider_testcase { $this->assertCount(2, $contextlist); $contextids = $contextlist->get_contextids(); - $this->assertEqualsCanonicalizing([$coursecontext1->id, $coursecontext2->id], $contextids); + $this->assertEqualsCanonicalizing([$coursecontext1->id, $coursecontext2->id], array_values($contextids)); } /** diff --git a/question/bank/statistics/tests/helper_test.php b/question/bank/statistics/tests/helper_test.php index 2dec158f3fc..61abe70fcbd 100644 --- a/question/bank/statistics/tests/helper_test.php +++ b/question/bank/statistics/tests/helper_test.php @@ -272,32 +272,42 @@ final class helper_test extends \advanced_testcase { */ public static function load_question_facility_provider(): \Generator { yield 'Facility case 1' => [ - 'Quiz 1 attempts' => [ + // Quiz 1 attempts. + 'quiz1attempts' => [ self::generate_attempt_answers([1, 0, 0, 0]), ], - 'Expected quiz 1 facilities' => ['100.00%', '0.00%', '0.00%', '0.00%'], - 'Quiz 2 attempts' => [ + // Expected quiz 1 facilities. + 'expectedquiz1facilities' => ['100.00%', '0.00%', '0.00%', '0.00%'], + // Quiz 2 attempts. + 'quiz2attempts' => [ self::generate_attempt_answers([1, 0, 0, 0]), self::generate_attempt_answers([1, 1, 0, 0]), ], - 'Expected quiz 2 facilities' => ['100.00%', '50.00%', '0.00%', '0.00%'], - 'Expected average facilities' => ['100.00%', '25.00%', '0.00%', '0.00%'], + // Expected quiz 2 facilities. + 'expectedquiz2facilities' => ['100.00%', '50.00%', '0.00%', '0.00%'], + // Expected average facilities. + 'expectedaveragefacilities' => ['100.00%', '25.00%', '0.00%', '0.00%'], ]; yield 'Facility case 2' => [ - 'Quiz 1 attempts' => [ + // Quiz 1 attempts. + 'quiz1attempts' => [ self::generate_attempt_answers([1, 0, 0, 0]), self::generate_attempt_answers([1, 1, 0, 0]), self::generate_attempt_answers([1, 1, 1, 0]), ], - 'Expected quiz 1 facilities' => ['100.00%', '66.67%', '33.33%', '0.00%'], - 'Quiz 2 attempts' => [ + // Expected quiz 1 facilities. + 'expectedquiz1facilities' => ['100.00%', '66.67%', '33.33%', '0.00%'], + // Quiz 2 attempts. + 'quiz2attempts' => [ self::generate_attempt_answers([1, 0, 0, 0]), self::generate_attempt_answers([1, 1, 0, 0]), self::generate_attempt_answers([1, 1, 1, 0]), self::generate_attempt_answers([1, 1, 1, 1]), ], - 'Expected quiz 2 facilities' => ['100.00%', '75.00%', '50.00%', '25.00%'], - 'Expected average facilities' => ['100.00%', '70.83%', '41.67%', '12.50%'], + // Expected quiz 2 facilities. + 'expectedquiz2facilities' => ['100.00%', '75.00%', '50.00%', '25.00%'], + // Expected average facilities. + 'expectedaveragefacilities' => ['100.00%', '70.83%', '41.67%', '12.50%'], ]; } @@ -380,21 +390,26 @@ final class helper_test extends \advanced_testcase { */ public static function load_question_discriminative_efficiency_provider(): \Generator { yield 'Discriminative efficiency' => [ - 'Quiz 1 attempts' => [ + // Quiz 1 attempts. + 'quiz1attempts' => [ self::generate_attempt_answers([1, 0, 0, 0]), self::generate_attempt_answers([1, 1, 0, 0]), self::generate_attempt_answers([1, 0, 1, 0]), self::generate_attempt_answers([1, 1, 1, 1]), ], - 'Expected quiz 1 discriminative efficiency' => ['N/A', '33.33%', '33.33%', '100.00%'], - 'Quiz 2 attempts' => [ + // Expected quiz 1 facilities. + 'expectedquiz1discriminativeefficiency' => ['N/A', '33.33%', '33.33%', '100.00%'], + // Quiz 2 attempts. + 'quiz2attempts' => [ self::generate_attempt_answers([1, 1, 1, 1]), self::generate_attempt_answers([0, 0, 0, 0]), self::generate_attempt_answers([1, 0, 0, 1]), self::generate_attempt_answers([0, 1, 1, 0]), ], - 'Expected quiz 2 discriminative efficiency' => ['50.00%', '50.00%', '50.00%', '50.00%'], - 'Expected average discriminative efficiency' => ['50.00%', '41.67%', '41.67%', '75.00%'], + // Expected quiz 2 facilities. + 'expectedquiz2discriminativeefficiency' => ['50.00%', '50.00%', '50.00%', '50.00%'], + // Expected average facilities. + 'expectedaveragediscriminativeefficiency' => ['50.00%', '41.67%', '41.67%', '75.00%'], ]; } @@ -501,21 +516,26 @@ final class helper_test extends \advanced_testcase { */ public static function load_question_discrimination_index_provider(): \Generator { yield 'Discrimination Index' => [ - 'Quiz 1 attempts' => [ + // Quiz 1 attempts. + 'quiz1attempts' => [ self::generate_attempt_answers([1, 0, 0, 0]), self::generate_attempt_answers([1, 1, 0, 0]), self::generate_attempt_answers([1, 0, 1, 0]), self::generate_attempt_answers([1, 1, 1, 1]), ], - 'Expected quiz 1 Discrimination Index' => ['N/A', '30.15%', '30.15%', '81.65%'], - 'Quiz 2 attempts' => [ + // Expected quiz 1 facilities. + 'expectedquiz1discriminationindex' => ['N/A', '30.15%', '30.15%', '81.65%'], + // Quiz 2 attempts. + 'quiz2attempts' => [ self::generate_attempt_answers([1, 1, 1, 1]), self::generate_attempt_answers([0, 0, 0, 0]), self::generate_attempt_answers([1, 0, 0, 1]), self::generate_attempt_answers([0, 1, 1, 0]), ], - 'Expected quiz 2 discrimination Index' => ['44.72%', '44.72%', '44.72%', '44.72%'], - 'Expected average discrimination Index' => ['44.72%', '37.44%', '37.44%', '63.19%'], + // Expected quiz 2 facilities. + 'expectedquiz2discriminationindex' => ['44.72%', '44.72%', '44.72%', '44.72%'], + // Expected average facilities. + 'expectedaveragediscriminationindex' => ['44.72%', '37.44%', '37.44%', '63.19%'], ]; } diff --git a/question/engine/tests/question_engine_test.php b/question/engine/tests/question_engine_test.php index 89655479f69..6df1206083f 100644 --- a/question/engine/tests/question_engine_test.php +++ b/question/engine/tests/question_engine_test.php @@ -209,12 +209,12 @@ final class question_engine_test extends advanced_testcase { * @dataProvider is_manual_grade_in_range_provider * @covers \question_engine::is_manual_grade_in_range * @param array $post The values to add to $_POST - * @param array $params The params to pass to is_manual_grade_in_range + * @param array $range The params to pass to is_manual_grade_in_range * @param bool $expected */ - public function test_is_manual_grade_in_range(array $post, array $params, bool $expected): void { + public function test_is_manual_grade_in_range(array $post, array $range, bool $expected): void { $_POST[] = $post; - $this->assertEquals($expected, question_engine::is_manual_grade_in_range(...$params)); + $this->assertEquals($expected, question_engine::is_manual_grade_in_range(...$range)); } /** diff --git a/question/tests/local/statistics/statistics_bulk_loader_test.php b/question/tests/local/statistics/statistics_bulk_loader_test.php index e71c09e312b..785400eac77 100644 --- a/question/tests/local/statistics/statistics_bulk_loader_test.php +++ b/question/tests/local/statistics/statistics_bulk_loader_test.php @@ -290,32 +290,42 @@ final class statistics_bulk_loader_test extends advanced_testcase { */ public static function load_question_facility_provider(): Generator { yield 'Facility case 1' => [ - 'Quiz 1 attempts' => [ + // Quiz 1 attempts. + [ self::generate_attempt_answers([1, 0, 0, 0]), ], - 'Expected quiz 1 facilities' => [1.0, 0.0, 0.0, 0.0], - 'Quiz 2 attempts' => [ + // Expected quiz 1 facilities. + [1.0, 0.0, 0.0, 0.0], + // Quiz 2 attempts. + [ self::generate_attempt_answers([1, 0, 0, 0]), self::generate_attempt_answers([1, 1, 0, 0]), ], - 'Expected quiz 2 facilities' => [1.0, 0.5, 0.0, 0.0], - 'Expected average facilities' => [1.0, 0.25, 0.0, 0.0], + // Expected quiz 2 facilities. + [1.0, 0.5, 0.0, 0.0], + // Expected average facilities. + [1.0, 0.25, 0.0, 0.0], ]; yield 'Facility case 2' => [ - 'Quiz 1 attempts' => [ + // Quiz 1 attempts. + [ self::generate_attempt_answers([1, 0, 0, 0]), self::generate_attempt_answers([1, 1, 0, 0]), self::generate_attempt_answers([1, 1, 1, 0]), ], - 'Expected quiz 1 facilities' => [1.0, 0.6667, 0.3333, 0.0], - 'Quiz 2 attempts' => [ + // Expected quiz 1 facilities. + [1.0, 0.6667, 0.3333, 0.0], + // Quiz 2 attempts. + [ self::generate_attempt_answers([1, 0, 0, 0]), self::generate_attempt_answers([1, 1, 0, 0]), self::generate_attempt_answers([1, 1, 1, 0]), self::generate_attempt_answers([1, 1, 1, 1]), ], - 'Expected quiz 2 facilities' => [1.0, 0.75, 0.5, 0.25], - 'Expected average facilities' => [1.0, 0.7083, 0.4167, 0.1250], + // Expected quiz 2 facilities. + [1.0, 0.75, 0.5, 0.25], + // Expected average facilities. + [1.0, 0.7083, 0.4167, 0.1250], ]; } @@ -399,21 +409,26 @@ final class statistics_bulk_loader_test extends advanced_testcase { */ public static function load_question_discriminative_efficiency_provider(): Generator { yield 'Discriminative efficiency' => [ - 'Quiz 1 attempts' => [ + // Quiz 1 attempts. + [ self::generate_attempt_answers([1, 0, 0, 0]), self::generate_attempt_answers([1, 1, 0, 0]), self::generate_attempt_answers([1, 0, 1, 0]), self::generate_attempt_answers([1, 1, 1, 1]), ], - 'Expected quiz 1 discriminative efficiency' => [null, 33.33, 33.33, 100.00], - 'Quiz 2 attempts' => [ + // Expected quiz 1 discriminative efficiency. + [null, 33.33, 33.33, 100.00], + // Quiz 2 attempts. + [ self::generate_attempt_answers([1, 1, 1, 1]), self::generate_attempt_answers([0, 0, 0, 0]), self::generate_attempt_answers([1, 0, 0, 1]), self::generate_attempt_answers([0, 1, 1, 0]), ], - 'Expected quiz 2 discriminative efficiency' => [50.00, 50.00, 50.00, 50.00], - 'Expected average discriminative efficiency' => [50.00, 41.67, 41.67, 75.00], + // Expected quiz 2 discriminative efficiency. + [50.00, 50.00, 50.00, 50.00], + // Expected average discriminative efficiency. + [50.00, 41.67, 41.67, 75.00], ]; } @@ -529,21 +544,26 @@ final class statistics_bulk_loader_test extends advanced_testcase { */ public static function load_question_discrimination_index_provider(): Generator { yield 'Discrimination Index' => [ - 'Quiz 1 attempts' => [ + // Quiz 1 attempts. + [ self::generate_attempt_answers([1, 0, 0, 0]), self::generate_attempt_answers([1, 1, 0, 0]), self::generate_attempt_answers([1, 0, 1, 0]), self::generate_attempt_answers([1, 1, 1, 1]), ], - 'Expected quiz 1 Discrimination Index' => [null, 30.15, 30.15, 81.65], - 'Quiz 2 attempts' => [ + // Expected quiz 1 Discrimination Index. + [null, 30.15, 30.15, 81.65], + // Quiz 2 attempts. + [ self::generate_attempt_answers([1, 1, 1, 1]), self::generate_attempt_answers([0, 0, 0, 0]), self::generate_attempt_answers([1, 0, 0, 1]), self::generate_attempt_answers([0, 1, 1, 0]), ], - 'Expected quiz 2 discrimination Index' => [44.72, 44.72, 44.72, 44.72], - 'Expected average discrimination Index' => [44.72, 37.44, 37.44, 63.19], + // Expected quiz 2 discrimination Index. + [44.72, 44.72, 44.72, 44.72], + // Expected average discrimination Index. + [44.72, 37.44, 37.44, 63.19], ]; } diff --git a/question/tests/privacy/provider_test.php b/question/tests/privacy/provider_test.php index fc429a44bcf..a79576e489e 100644 --- a/question/tests/privacy/provider_test.php +++ b/question/tests/privacy/provider_test.php @@ -226,7 +226,11 @@ final class provider_test extends \core_privacy\tests\provider_testcase { $expectedcontext->id, $otherexpectedcontext->id, ]; - $this->assertEqualsCanonicalizing($expectedcontexts, $contextlist->get_contextids(), 'Contexts not equal'); + $this->assertEqualsCanonicalizing( + $expectedcontexts, + array_values($contextlist->get_contextids()), + 'Contexts not equal', + ); // Run the export_user_Data as the test user. $this->setUser($user); diff --git a/reportbuilder/tests/external/system_report_exporter_test.php b/reportbuilder/tests/external/system_report_exporter_test.php index 29f08983398..ac15d7b902f 100644 --- a/reportbuilder/tests/external/system_report_exporter_test.php +++ b/reportbuilder/tests/external/system_report_exporter_test.php @@ -51,8 +51,8 @@ final class system_report_exporter_test extends advanced_testcase { */ public static function export_provider(): array { return [ - ['With filters' => true], - ['Without filters' => false], + 'With filters' => [true], + 'Without filters' => [false], ]; } diff --git a/reportbuilder/tests/generator_test.php b/reportbuilder/tests/generator_test.php index 34a2c38a76a..23bdd96aaa7 100644 --- a/reportbuilder/tests/generator_test.php +++ b/reportbuilder/tests/generator_test.php @@ -48,8 +48,10 @@ final class generator_test extends advanced_testcase { $report = $generator->create_report(['name' => 'My report', 'source' => users::class, 'tags' => ['cat', 'dog']]); $this->assertTrue(report::record_exists($report->get('id'))); - $this->assertEqualsCanonicalizing(['cat', 'dog'], - core_tag_tag::get_item_tags_array('core_reportbuilder', 'reportbuilder_report', $report->get('id'))); + $this->assertEqualsCanonicalizing( + ['cat', 'dog'], + array_values(core_tag_tag::get_item_tags_array('core_reportbuilder', 'reportbuilder_report', $report->get('id'))), + ); } /** diff --git a/reportbuilder/tests/local/helpers/report_test.php b/reportbuilder/tests/local/helpers/report_test.php index 8c911268d77..ae5fe44cea2 100644 --- a/reportbuilder/tests/local/helpers/report_test.php +++ b/reportbuilder/tests/local/helpers/report_test.php @@ -51,8 +51,10 @@ final class report_test extends advanced_testcase { $this->assertEquals('My report with tags', $report->get('name')); $this->assertEquals(datasource::TYPE_CUSTOM_REPORT, $report->get('type')); - $this->assertEqualsCanonicalizing(['cat', 'dog'], - core_tag_tag::get_item_tags_array('core_reportbuilder', 'reportbuilder_report', $report->get('id'))); + $this->assertEqualsCanonicalizing( + ['cat', 'dog'], + array_values(core_tag_tag::get_item_tags_array('core_reportbuilder', 'reportbuilder_report', $report->get('id'))), + ); $report = report::create_report((object) [ 'name' => 'My report without tags', @@ -96,8 +98,10 @@ final class report_test extends advanced_testcase { $this->assertEquals('My renamed report adding tags', $reportupdated->get('name')); $this->assertTrue($reportupdated->get('uniquerows')); - $this->assertEqualsCanonicalizing(['cat', 'dog'], - core_tag_tag::get_item_tags_array('core_reportbuilder', 'reportbuilder_report', $reportupdated->get('id'))); + $this->assertEqualsCanonicalizing( + ['cat', 'dog'], + array_values(core_tag_tag::get_item_tags_array('core_reportbuilder', 'reportbuilder_report', $reportupdated->get('id'))), + ); } /** diff --git a/reportbuilder/tests/local/report/base_test.php b/reportbuilder/tests/local/report/base_test.php index 24c12056b2d..c5eaf7af9ad 100644 --- a/reportbuilder/tests/local/report/base_test.php +++ b/reportbuilder/tests/local/report/base_test.php @@ -56,7 +56,7 @@ final class base_test extends advanced_testcase { $systemreport->add_base_condition_simple('username', 'admin'); [$where, $params] = $systemreport->get_base_condition(); $this->assertStringMatchesFormat('username = :%a', $where); - $this->assertEqualsCanonicalizing(['admin'], $params); + $this->assertEqualsCanonicalizing(['admin'], array_values($params)); } /** diff --git a/repository/nextcloud/tests/lib_test.php b/repository/nextcloud/tests/lib_test.php index 847cef82cfb..f8c21441dd7 100644 --- a/repository/nextcloud/tests/lib_test.php +++ b/repository/nextcloud/tests/lib_test.php @@ -948,17 +948,17 @@ XML; * * @dataProvider sync_reference_provider * @param array $storedfileargs - * @param array $storedfilemethodsmock + * @param array $mockfunctions * @param bool $expectedresult * @return void */ - public function test_sync_reference(array $storedfileargs, $storedfilemethodsmock, bool $expectedresult): void { + public function test_sync_reference(array $storedfileargs, $mockfunctions, bool $expectedresult): void { $this->resetAfterTest(true); - if (isset($storedfilemethodsmock[0])) { + if (isset($mockfunctions[0])) { $storedfile = $this->createMock(\stored_file::class); - if ($storedfilemethodsmock[0] === 'get_referencelastsync') { + if ($mockfunctions[0] === 'get_referencelastsync') { if (!$expectedresult) { $storedfile->method('get_referencelastsync')->willReturn(DAYSECS + time()); } diff --git a/sms/tests/manager_test.php b/sms/tests/manager_test.php index 7737a8b6748..6a2379554e4 100644 --- a/sms/tests/manager_test.php +++ b/sms/tests/manager_test.php @@ -409,7 +409,7 @@ final class manager_test extends \advanced_testcase { $manager = \core\di::get(\core_sms\manager::class); $this->expectException(\coding_exception::class); - $this->getExpectedExceptionMessage('Sensitive messages cannot be sent asynchronously'); + $this->expectExceptionMessage('Sensitive messages cannot be sent asynchronously'); $manager->send( recipientnumber: '+447123456789', content: 'Hello, world!', @@ -427,7 +427,7 @@ final class manager_test extends \advanced_testcase { $manager = \core\di::get(\core_sms\manager::class); $this->expectException(\coding_exception::class); - $this->getExpectedExceptionMessage('Asynchronous sending is not yet implemented'); + $this->expectExceptionMessage('Asynchronous sending is not yet implemented'); $manager->send( recipientnumber: '+447123456789', content: 'Hello, world!', diff --git a/user/tests/table/participants_search_test.php b/user/tests/table/participants_search_test.php index b04b60c6667..98180bbabcb 100644 --- a/user/tests/table/participants_search_test.php +++ b/user/tests/table/participants_search_test.php @@ -191,7 +191,7 @@ final class participants_search_test extends advanced_testcase { $tests = [ // Users who only have one role each. 'Users in each role' => (object) [ - 'users' => [ + 'usersdata' => [ 'a' => [ 'courseroles' => [ 'student', @@ -248,7 +248,7 @@ final class participants_search_test extends advanced_testcase { 'expect' => [ // Tests for jointype: ANY. 'ANY: No role filter' => (object) [ - 'roles' => [], + 'testroles' => [], 'jointype' => filter::JOINTYPE_ANY, 'count' => 8, 'expectedusers' => [ @@ -263,7 +263,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on student' => (object) [ - 'roles' => ['student'], + 'testroles' => ['student'], 'jointype' => filter::JOINTYPE_ANY, 'count' => 2, 'expectedusers' => [ @@ -272,7 +272,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on student, teacher' => (object) [ - 'roles' => ['student', 'teacher'], + 'testroles' => ['student', 'teacher'], 'jointype' => filter::JOINTYPE_ANY, 'count' => 4, 'expectedusers' => [ @@ -283,7 +283,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on student, manager (category level role)' => (object) [ - 'roles' => ['student', 'manager'], + 'testroles' => ['student', 'manager'], 'jointype' => filter::JOINTYPE_ANY, 'count' => 3, 'expectedusers' => [ @@ -293,7 +293,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on student, coursecreator (not assigned)' => (object) [ - 'roles' => ['student', 'coursecreator'], + 'testroles' => ['student', 'coursecreator'], 'jointype' => filter::JOINTYPE_ANY, 'count' => 2, 'expectedusers' => [ @@ -304,7 +304,7 @@ final class participants_search_test extends advanced_testcase { // Tests for jointype: ALL. 'ALL: No role filter' => (object) [ - 'roles' => [], + 'testroles' => [], 'jointype' => filter::JOINTYPE_ALL, 'count' => 8, 'expectedusers' => [ @@ -319,7 +319,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ALL: Filter on student' => (object) [ - 'roles' => ['student'], + 'testroles' => ['student'], 'jointype' => filter::JOINTYPE_ALL, 'count' => 2, 'expectedusers' => [ @@ -328,19 +328,19 @@ final class participants_search_test extends advanced_testcase { ], ], 'ALL: Filter on student, teacher' => (object) [ - 'roles' => ['student', 'teacher'], + 'testroles' => ['student', 'teacher'], 'jointype' => filter::JOINTYPE_ALL, 'count' => 0, 'expectedusers' => [], ], 'ALL: Filter on student, manager (category level role))' => (object) [ - 'roles' => ['student', 'manager'], + 'testroles' => ['student', 'manager'], 'jointype' => filter::JOINTYPE_ALL, 'count' => 0, 'expectedusers' => [], ], 'ALL: Filter on student, coursecreator (not assigned))' => (object) [ - 'roles' => ['student', 'coursecreator'], + 'testroles' => ['student', 'coursecreator'], 'jointype' => filter::JOINTYPE_ALL, 'count' => 0, 'expectedusers' => [], @@ -348,7 +348,7 @@ final class participants_search_test extends advanced_testcase { // Tests for jointype: NONE. 'NONE: No role filter' => (object) [ - 'roles' => [], + 'testroles' => [], 'jointype' => filter::JOINTYPE_NONE, 'count' => 8, 'expectedusers' => [ @@ -363,7 +363,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on student' => (object) [ - 'roles' => ['student'], + 'testroles' => ['student'], 'jointype' => filter::JOINTYPE_NONE, 'count' => 6, 'expectedusers' => [ @@ -376,7 +376,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on student, teacher' => (object) [ - 'roles' => ['student', 'teacher'], + 'testroles' => ['student', 'teacher'], 'jointype' => filter::JOINTYPE_NONE, 'count' => 4, 'expectedusers' => [ @@ -387,7 +387,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on student, manager (category level role))' => (object) [ - 'roles' => ['student', 'manager'], + 'testroles' => ['student', 'manager'], 'jointype' => filter::JOINTYPE_NONE, 'count' => 5, 'expectedusers' => [ @@ -399,7 +399,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on student, coursecreator (not assigned))' => (object) [ - 'roles' => ['student', 'coursecreator'], + 'testroles' => ['student', 'coursecreator'], 'jointype' => filter::JOINTYPE_NONE, 'count' => 6, 'expectedusers' => [ @@ -414,7 +414,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'Users with multiple roles' => (object) [ - 'users' => [ + 'usersdata' => [ 'a' => [ 'courseroles' => [ 'student', @@ -474,7 +474,7 @@ final class participants_search_test extends advanced_testcase { 'expect' => [ // Tests for jointype: ANY. 'ANY: No role filter' => (object) [ - 'roles' => [], + 'testroles' => [], 'jointype' => filter::JOINTYPE_ANY, 'count' => 8, 'expectedusers' => [ @@ -489,7 +489,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on student' => (object) [ - 'roles' => ['student'], + 'testroles' => ['student'], 'jointype' => filter::JOINTYPE_ANY, 'count' => 2, 'expectedusers' => [ @@ -498,7 +498,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on teacher' => (object) [ - 'roles' => ['teacher'], + 'testroles' => ['teacher'], 'jointype' => filter::JOINTYPE_ANY, 'count' => 3, 'expectedusers' => [ @@ -508,7 +508,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on editingteacher' => (object) [ - 'roles' => ['editingteacher'], + 'testroles' => ['editingteacher'], 'jointype' => filter::JOINTYPE_ANY, 'count' => 3, 'expectedusers' => [ @@ -518,7 +518,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on student, teacher' => (object) [ - 'roles' => ['student', 'teacher'], + 'testroles' => ['student', 'teacher'], 'jointype' => filter::JOINTYPE_ANY, 'count' => 4, 'expectedusers' => [ @@ -529,7 +529,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on teacher, editingteacher' => (object) [ - 'roles' => ['teacher', 'editingteacher'], + 'testroles' => ['teacher', 'editingteacher'], 'jointype' => filter::JOINTYPE_ANY, 'count' => 5, 'expectedusers' => [ @@ -541,7 +541,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on student, manager (category level role)' => (object) [ - 'roles' => ['student', 'manager'], + 'testroles' => ['student', 'manager'], 'jointype' => filter::JOINTYPE_ANY, 'count' => 3, 'expectedusers' => [ @@ -551,7 +551,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on student, coursecreator (not assigned)' => (object) [ - 'roles' => ['student', 'coursecreator'], + 'testroles' => ['student', 'coursecreator'], 'jointype' => filter::JOINTYPE_ANY, 'count' => 2, 'expectedusers' => [ @@ -562,7 +562,7 @@ final class participants_search_test extends advanced_testcase { // Tests for jointype: ALL. 'ALL: No role filter' => (object) [ - 'roles' => [], + 'testroles' => [], 'jointype' => filter::JOINTYPE_ALL, 'count' => 8, 'expectedusers' => [ @@ -577,7 +577,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ALL: Filter on student' => (object) [ - 'roles' => ['student'], + 'testroles' => ['student'], 'jointype' => filter::JOINTYPE_ALL, 'count' => 2, 'expectedusers' => [ @@ -586,7 +586,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ALL: Filter on teacher' => (object) [ - 'roles' => ['teacher'], + 'testroles' => ['teacher'], 'jointype' => filter::JOINTYPE_ALL, 'count' => 3, 'expectedusers' => [ @@ -596,7 +596,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ALL: Filter on editingteacher' => (object) [ - 'roles' => ['editingteacher'], + 'testroles' => ['editingteacher'], 'jointype' => filter::JOINTYPE_ALL, 'count' => 3, 'expectedusers' => [ @@ -606,7 +606,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ALL: Filter on student, teacher' => (object) [ - 'roles' => ['student', 'teacher'], + 'testroles' => ['student', 'teacher'], 'jointype' => filter::JOINTYPE_ALL, 'count' => 1, 'expectedusers' => [ @@ -614,7 +614,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ALL: Filter on teacher, editingteacher' => (object) [ - 'roles' => ['teacher', 'editingteacher'], + 'testroles' => ['teacher', 'editingteacher'], 'jointype' => filter::JOINTYPE_ALL, 'count' => 1, 'expectedusers' => [ @@ -622,13 +622,13 @@ final class participants_search_test extends advanced_testcase { ], ], 'ALL: Filter on student, manager (category level role)' => (object) [ - 'roles' => ['student', 'manager'], + 'testroles' => ['student', 'manager'], 'jointype' => filter::JOINTYPE_ALL, 'count' => 0, 'expectedusers' => [], ], 'ALL: Filter on student, coursecreator (not assigned)' => (object) [ - 'roles' => ['student', 'coursecreator'], + 'testroles' => ['student', 'coursecreator'], 'jointype' => filter::JOINTYPE_ALL, 'count' => 0, 'expectedusers' => [], @@ -636,7 +636,7 @@ final class participants_search_test extends advanced_testcase { // Tests for jointype: NONE. 'NONE: No role filter' => (object) [ - 'roles' => [], + 'testroles' => [], 'jointype' => filter::JOINTYPE_NONE, 'count' => 8, 'expectedusers' => [ @@ -651,7 +651,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on student' => (object) [ - 'roles' => ['student'], + 'testroles' => ['student'], 'jointype' => filter::JOINTYPE_NONE, 'count' => 6, 'expectedusers' => [ @@ -664,7 +664,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on teacher' => (object) [ - 'roles' => ['teacher'], + 'testroles' => ['teacher'], 'jointype' => filter::JOINTYPE_NONE, 'count' => 5, 'expectedusers' => [ @@ -676,7 +676,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on editingteacher' => (object) [ - 'roles' => ['editingteacher'], + 'testroles' => ['editingteacher'], 'jointype' => filter::JOINTYPE_NONE, 'count' => 5, 'expectedusers' => [ @@ -688,7 +688,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on student, teacher' => (object) [ - 'roles' => ['student', 'teacher'], + 'testroles' => ['student', 'teacher'], 'jointype' => filter::JOINTYPE_NONE, 'count' => 4, 'expectedusers' => [ @@ -699,7 +699,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on teacher, editingteacher' => (object) [ - 'roles' => ['teacher', 'editingteacher'], + 'testroles' => ['teacher', 'editingteacher'], 'jointype' => filter::JOINTYPE_NONE, 'count' => 3, 'expectedusers' => [ @@ -709,7 +709,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on student, manager (category level role)' => (object) [ - 'roles' => ['student', 'manager'], + 'testroles' => ['student', 'manager'], 'jointype' => filter::JOINTYPE_NONE, 'count' => 5, 'expectedusers' => [ @@ -721,7 +721,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on student, coursecreator (not assigned)' => (object) [ - 'roles' => ['student', 'coursecreator'], + 'testroles' => ['student', 'coursecreator'], 'jointype' => filter::JOINTYPE_NONE, 'count' => 6, 'expectedusers' => [ @@ -741,8 +741,8 @@ final class participants_search_test extends advanced_testcase { foreach ($tests as $testname => $testdata) { foreach ($testdata->expect as $expectname => $expectdata) { $finaltests["{$testname} => {$expectname}"] = [ - 'users' => $testdata->users, - 'roles' => $expectdata->roles, + 'usersdata' => $testdata->usersdata, + 'testroles' => $expectdata->testroles, 'jointype' => $expectdata->jointype, 'count' => $expectdata->count, 'expectedusers' => $expectdata->expectedusers, @@ -803,7 +803,7 @@ final class participants_search_test extends advanced_testcase { */ public static function country_provider(): array { $tests = [ - 'users' => [ + 'usersdata' => [ 'user1' => 'DE', 'user2' => 'ES', 'user3' => 'ES', @@ -910,7 +910,7 @@ final class participants_search_test extends advanced_testcase { $finaltests = []; foreach ($tests['expects'] as $testname => $test) { $finaltests[$testname] = [ - 'users' => $tests['users'], + 'usersdata' => $tests['usersdata'], 'countries' => $test->countries, 'jointype' => $test->jointype, 'expectedusers' => $test->expectedusers, @@ -1002,7 +1002,7 @@ final class participants_search_test extends advanced_testcase { $tests = [ // Users where the keyword matches basic user fields such as names and email. 'Users with basic names' => (object) [ - 'users' => [ + 'usersdata' => [ 'adam.ant' => [ 'firstname' => 'Adam', 'lastname' => 'Ant', @@ -1458,7 +1458,7 @@ final class participants_search_test extends advanced_testcase { foreach ($tests as $testname => $testdata) { foreach ($testdata->expect as $expectname => $expectdata) { $finaltests["{$testname} => {$expectname}"] = [ - 'users' => $testdata->users, + 'usersdata' => $testdata->usersdata, 'keywords' => $expectdata->keywords, 'jointype' => $expectdata->jointype, 'count' => $expectdata->count, @@ -1499,8 +1499,8 @@ final class participants_search_test extends advanced_testcase { foreach ($usersdata as $username => $userdata) { $user = $this->getDataGenerator()->create_user(['username' => $username]); - if (array_key_exists('status', $userdata)) { - foreach ($userdata['status'] as $enrolmethod => $status) { + if (array_key_exists('statuses', $userdata)) { + foreach ($userdata['statuses'] as $enrolmethod => $status) { $this->getDataGenerator()->enrol_user($user->id, $course->id, 'student', $enrolmethod, 0, 0, $status); } } @@ -1550,29 +1550,29 @@ final class participants_search_test extends advanced_testcase { $tests = [ // Users with different statuses and enrolment methods (so multiple statuses are possible for the same user). 'Users with different enrolment statuses' => (object) [ - 'users' => [ + 'usersdata' => [ 'a' => [ - 'status' => [ + 'statuses' => [ 'manual' => ENROL_USER_ACTIVE, ] ], 'b' => [ - 'status' => [ + 'statuses' => [ 'self' => ENROL_USER_ACTIVE, ] ], 'c' => [ - 'status' => [ + 'statuses' => [ 'manual' => ENROL_USER_SUSPENDED, ] ], 'd' => [ - 'status' => [ + 'statuses' => [ 'self' => ENROL_USER_SUSPENDED, ] ], 'e' => [ - 'status' => [ + 'statuses' => [ 'manual' => ENROL_USER_ACTIVE, 'self' => ENROL_USER_SUSPENDED, ] @@ -1581,7 +1581,7 @@ final class participants_search_test extends advanced_testcase { 'expect' => [ // Tests for jointype: ANY. 'ANY: No filter' => (object) [ - 'status' => [], + 'statuses' => [], 'jointype' => filter::JOINTYPE_ANY, 'count' => 5, 'expectedusers' => [ @@ -1593,7 +1593,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on active only' => (object) [ - 'status' => [ENROL_USER_ACTIVE], + 'statuses' => [ENROL_USER_ACTIVE], 'jointype' => filter::JOINTYPE_ANY, 'count' => 3, 'expectedusers' => [ @@ -1603,7 +1603,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on suspended only' => (object) [ - 'status' => [ENROL_USER_SUSPENDED], + 'statuses' => [ENROL_USER_SUSPENDED], 'jointype' => filter::JOINTYPE_ANY, 'count' => 3, 'expectedusers' => [ @@ -1613,7 +1613,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ANY: Filter on multiple statuses' => (object) [ - 'status' => [ENROL_USER_ACTIVE, ENROL_USER_SUSPENDED], + 'statuses' => [ENROL_USER_ACTIVE, ENROL_USER_SUSPENDED], 'jointype' => filter::JOINTYPE_ANY, 'count' => 5, 'expectedusers' => [ @@ -1627,7 +1627,7 @@ final class participants_search_test extends advanced_testcase { // Tests for jointype: ALL. 'ALL: No filter' => (object) [ - 'status' => [], + 'statuses' => [], 'jointype' => filter::JOINTYPE_ALL, 'count' => 5, 'expectedusers' => [ @@ -1639,7 +1639,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ALL: Filter on active only' => (object) [ - 'status' => [ENROL_USER_ACTIVE], + 'statuses' => [ENROL_USER_ACTIVE], 'jointype' => filter::JOINTYPE_ALL, 'count' => 3, 'expectedusers' => [ @@ -1649,7 +1649,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ALL: Filter on suspended only' => (object) [ - 'status' => [ENROL_USER_SUSPENDED], + 'statuses' => [ENROL_USER_SUSPENDED], 'jointype' => filter::JOINTYPE_ALL, 'count' => 3, 'expectedusers' => [ @@ -1659,7 +1659,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'ALL: Filter on multiple statuses' => (object) [ - 'status' => [ENROL_USER_ACTIVE, ENROL_USER_SUSPENDED], + 'statuses' => [ENROL_USER_ACTIVE, ENROL_USER_SUSPENDED], 'jointype' => filter::JOINTYPE_ALL, 'count' => 1, 'expectedusers' => [ @@ -1669,7 +1669,7 @@ final class participants_search_test extends advanced_testcase { // Tests for jointype: NONE. 'NONE: No filter' => (object) [ - 'status' => [], + 'statuses' => [], 'jointype' => filter::JOINTYPE_NONE, 'count' => 5, 'expectedusers' => [ @@ -1681,7 +1681,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on active only' => (object) [ - 'status' => [ENROL_USER_ACTIVE], + 'statuses' => [ENROL_USER_ACTIVE], 'jointype' => filter::JOINTYPE_NONE, 'count' => 3, 'expectedusers' => [ @@ -1691,7 +1691,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on suspended only' => (object) [ - 'status' => [ENROL_USER_SUSPENDED], + 'statuses' => [ENROL_USER_SUSPENDED], 'jointype' => filter::JOINTYPE_NONE, 'count' => 3, 'expectedusers' => [ @@ -1701,7 +1701,7 @@ final class participants_search_test extends advanced_testcase { ], ], 'NONE: Filter on multiple statuses' => (object) [ - 'status' => [ENROL_USER_ACTIVE, ENROL_USER_SUSPENDED], + 'statuses' => [ENROL_USER_ACTIVE, ENROL_USER_SUSPENDED], 'jointype' => filter::JOINTYPE_NONE, 'count' => 0, 'expectedusers' => [], @@ -1714,8 +1714,8 @@ final class participants_search_test extends advanced_testcase { foreach ($tests as $testname => $testdata) { foreach ($testdata->expect as $expectname => $expectdata) { $finaltests["{$testname} => {$expectname}"] = [ - 'users' => $testdata->users, - 'status' => $expectdata->status, + 'usersdata' => $testdata->usersdata, + 'statuses' => $expectdata->statuses, 'jointype' => $expectdata->jointype, 'count' => $expectdata->count, 'expectedusers' => $expectdata->expectedusers, @@ -1807,7 +1807,7 @@ final class participants_search_test extends advanced_testcase { $tests = [ // Users with different enrolment methods. 'Users with different enrolment methods' => (object) [ - 'users' => [ + 'usersdata' => [ 'a' => [ 'enrolmethods' => [ 'manual', @@ -1928,7 +1928,7 @@ final class participants_search_test extends advanced_testcase { foreach ($tests as $testname => $testdata) { foreach ($testdata->expect as $expectname => $expectdata) { $finaltests["{$testname} => {$expectname}"] = [ - 'users' => $testdata->users, + 'usersdata' => $testdata->usersdata, 'enrolmethods' => $expectdata->enrolmethods, 'jointype' => $expectdata->jointype, 'count' => $expectdata->count, @@ -2037,7 +2037,7 @@ final class participants_search_test extends advanced_testcase { 'groupb', 'groupc', ], - 'users' => [ + 'usersdata' => [ 'a' => [ 'groups' => ['groupa'], ], @@ -2247,7 +2247,7 @@ final class participants_search_test extends advanced_testcase { foreach ($tests as $testname => $testdata) { foreach ($testdata->expect as $expectname => $expectdata) { $finaltests["{$testname} => {$expectname}"] = [ - 'users' => $testdata->users, + 'usersdata' => $testdata->usersdata, 'groupsavailable' => $testdata->groupsavailable, 'filtergroups' => $expectdata->groups, 'jointype' => $expectdata->jointype, @@ -2378,7 +2378,7 @@ final class participants_search_test extends advanced_testcase { 'groupb', 'groupc', ], - 'users' => [ + 'usersdata' => [ 'a' => [ 'groups' => ['groupa'], ], @@ -2648,7 +2648,7 @@ final class participants_search_test extends advanced_testcase { foreach ($tests as $testname => $testdata) { foreach ($testdata->expect as $expectname => $expectdata) { $finaltests["{$testname} => {$expectname}"] = [ - 'users' => $testdata->users, + 'usersdata' => $testdata->usersdata, 'groupsavailable' => $testdata->groupsavailable, 'filtergroups' => $expectdata->groups, 'jointype' => $expectdata->jointype, @@ -2736,7 +2736,7 @@ final class participants_search_test extends advanced_testcase { $tests = [ // Users with different last access times. 'Users in different groups' => (object) [ - 'users' => [ + 'usersdata' => [ 'a' => [ 'lastlogin' => '-3 days', ], @@ -2948,7 +2948,7 @@ final class participants_search_test extends advanced_testcase { foreach ($tests as $testname => $testdata) { foreach ($testdata->expect as $expectname => $expectdata) { $finaltests["{$testname} => {$expectname}"] = [ - 'users' => $testdata->users, + 'usersdata' => $testdata->usersdata, 'accesssince' => $expectdata->accesssince, 'jointype' => $expectdata->jointype, 'count' => $expectdata->count, @@ -3148,7 +3148,7 @@ final class participants_search_test extends advanced_testcase { 'groupb', 'groupc', ], - 'users' => [ + 'usersdata' => [ 'adam.ant' => [ 'firstname' => 'Adam', 'lastname' => 'Ant', @@ -3498,7 +3498,7 @@ final class participants_search_test extends advanced_testcase { foreach ($tests as $testname => $testdata) { foreach ($testdata->expect as $expectname => $expectdata) { $finaltests["{$testname} => {$expectname}"] = [ - 'users' => $testdata->users, + 'usersdata' => $testdata->usersdata, 'filterdata' => $expectdata->filterdata, 'groupsavailable' => $testdata->groupsavailable, 'jointype' => $expectdata->jointype,