Skip to content

Commit

Permalink
Merge branch 'MDL-70070-400' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
…into MOODLE_400_STABLE
  • Loading branch information
andrewnicols committed Jan 19, 2023
2 parents c7f189d + dcb19ee commit f28a05b
Show file tree
Hide file tree
Showing 26 changed files with 119 additions and 178 deletions.
7 changes: 3 additions & 4 deletions admin/tool/log/store/database/tests/store_test.php
Expand Up @@ -33,8 +33,7 @@ class store_test extends \advanced_testcase {
* Tests log writing.
*
* @param bool $jsonformat True to test with JSON format
* @dataProvider test_log_writing_provider
* @throws moodle_exception
* @dataProvider log_writing_provider
*/
public function test_log_writing(bool $jsonformat) {
global $DB, $CFG;
Expand Down Expand Up @@ -252,9 +251,9 @@ public function test_log_writing(bool $jsonformat) {
* Returns different JSON format settings so the test can be run with JSON format either on or
* off.
*
* @return [bool] Array of true/false
* @return bool[] Array of true/false
*/
public static function test_log_writing_provider(): array {
public static function log_writing_provider(): array {
return [
[false],
[true]
Expand Down
14 changes: 6 additions & 8 deletions admin/tool/log/store/standard/tests/store_test.php
Expand Up @@ -38,8 +38,7 @@ class store_test extends \advanced_testcase {
* Tests log writing.
*
* @param bool $jsonformat True to test with JSON format
* @dataProvider test_log_writing_provider
* @throws moodle_exception
* @dataProvider log_writing_provider
*/
public function test_log_writing(bool $jsonformat) {
global $DB;
Expand Down Expand Up @@ -223,9 +222,9 @@ public function test_log_writing(bool $jsonformat) {
* Returns different JSON format settings so the test can be run with JSON format either on or
* off.
*
* @return [bool] Array of true/false
* @return bool[] Array of true/false
*/
public static function test_log_writing_provider(): array {
public static function log_writing_provider(): array {
return [
[false],
[true]
Expand Down Expand Up @@ -368,7 +367,7 @@ public function test_cleanup_task() {
* Tests the decode_other function can cope with both JSON and PHP serialized format.
*
* @param mixed $value Value to encode and decode
* @dataProvider test_decode_other_provider
* @dataProvider decode_other_provider
*/
public function test_decode_other($value) {
$this->assertEquals($value, \logstore_standard\log\store::decode_other(serialize($value)));
Expand All @@ -387,7 +386,7 @@ public function test_decode_other_with_wrongly_encoded_contents() {
*
* @return array Array of parameters
*/
public function test_decode_other_provider(): array {
public function decode_other_provider(): array {
return [
[['info' => 'd2819896', 'logurl' => 'discuss.php?d=2819896']],
[null],
Expand All @@ -400,8 +399,7 @@ public function test_decode_other_provider(): array {
* Checks that backup and restore of log data works correctly.
*
* @param bool $jsonformat True to test with JSON format
* @dataProvider test_log_writing_provider
* @throws moodle_exception
* @dataProvider log_writing_provider
*/
public function test_backup_restore(bool $jsonformat) {
global $DB;
Expand Down
8 changes: 4 additions & 4 deletions availability/condition/completion/tests/condition_test.php
Expand Up @@ -380,7 +380,7 @@ public function test_usage() {
/**
* Tests the is_available and get_description functions for previous activity option.
*
* @dataProvider test_previous_activity_data
* @dataProvider previous_activity_data
* @param int $grade the current assign grade (0 for none)
* @param int $condition true for complete, false for incomplete
* @param string $mark activity to mark as complete
Expand Down Expand Up @@ -469,7 +469,7 @@ public function test_previous_activity(int $grade, int $condition, string $mark,
$this->assertMatchesRegularExpression($description, $information);
}

public function test_previous_activity_data(): array {
public function previous_activity_data(): array {
// Assign grade, condition, activity to complete, activity to test, result, resultnot, description.
return [
'Missing previous activity complete' => [
Expand Down Expand Up @@ -561,7 +561,7 @@ public function test_previous_activity_data(): array {
* Tests the is_available and get_description functions for
* previous activity option in course sections.
*
* @dataProvider test_section_previous_activity_data
* @dataProvider section_previous_activity_data
* @param int $condition condition value
* @param bool $mark if Page 1 must be mark as completed
* @param string $section section to add the availability
Expand Down Expand Up @@ -634,7 +634,7 @@ public function test_section_previous_activity(int $condition, bool $mark, strin

}

public function test_section_previous_activity_data(): array {
public function section_previous_activity_data(): array {
return [
// Condition, Activity completion, section to test, result, resultnot, description.
'Completion complete Section with no previous activity' => [
Expand Down
10 changes: 5 additions & 5 deletions calendar/tests/externallib_test.php
Expand Up @@ -2795,7 +2795,7 @@ public function test_get_calendar_event_by_id_no_course_permission() {
*
* @return array
*/
public function test_get_calendar_event_by_id_prevent_read_other_users_events_data_provider(): array {
public function get_calendar_event_by_id_prevent_read_other_users_events_data_provider(): array {
$syscontext = \context_system::instance();
$managerrole = 'manager';
return [
Expand All @@ -2810,7 +2810,7 @@ public function test_get_calendar_event_by_id_prevent_read_other_users_events_da
* Prevent user from reading other user's event.
*
* @covers \core_calendar_external::get_calendar_event_by_id
* @dataProvider test_get_calendar_event_by_id_prevent_read_other_users_events_data_provider
* @dataProvider get_calendar_event_by_id_prevent_read_other_users_events_data_provider
*
* @param bool $isadminevent Is admin's event
* @param bool $isadmin Is current user admin user
Expand Down Expand Up @@ -2866,7 +2866,7 @@ public function test_get_calendar_event_by_id_prevent_read_other_users_events(
*
* @return array
*/
public function test_edit_or_delete_other_users_events_data_provider(): array {
public function edit_or_delete_other_users_events_data_provider(): array {
$syscontext = \context_system::instance();
$managerrole = 'manager';
return [
Expand All @@ -2880,7 +2880,7 @@ public function test_edit_or_delete_other_users_events_data_provider(): array {
/**
* Test the behavior of deleting other users' user events.
*
* @dataProvider test_edit_or_delete_other_users_events_data_provider
* @dataProvider edit_or_delete_other_users_events_data_provider
* @covers \core_calendar_external::delete_calendar_events
* @param bool $isadmin Whether the current user is admin.
* @param bool $isadminevent Whether it's an admin event or not.
Expand Down Expand Up @@ -2927,7 +2927,7 @@ public function test_delete_other_users_events(bool $isadmin, bool $isadminevent
/**
* Test the behavior of editing other users' user events
*
* @dataProvider test_edit_or_delete_other_users_events_data_provider
* @dataProvider edit_or_delete_other_users_events_data_provider
* @covers \core_calendar_external::submit_create_update_form
* @param bool $isadmin Whether the current user is admin.
* @param bool $isadminevent Whether it's an admin event or not.
Expand Down
12 changes: 6 additions & 6 deletions calendar/tests/std_proxy_test.php
Expand Up @@ -49,7 +49,7 @@ public function setUp(): void {
/**
* Test proxying.
*
* @dataProvider test_proxy_testcases()
* @dataProvider proxy_testcases
* @param int $id Object ID.
* @param string $member Object member to retrieve.
* @param mixed $expected Expected value of member.
Expand All @@ -65,7 +65,7 @@ public function test_proxy($id, $member, $expected) {
/**
* Test setting values with a base class.
*
* @dataProvider test_proxy_testcases()
* @dataProvider proxy_testcases
* @param int $id Object ID.
* @param string $member Object member to retrieve.
* @param mixed $storedvalue Value as would be stored externally.
Expand All @@ -86,7 +86,7 @@ function($id) {
/**
* Test getting a non existant member.
*
* @dataProvider test_get_set_testcases()
* @dataProvider get_set_testcases
* @param int $id ID of the object being proxied.
*/
public function test_get_invalid_member($id) {
Expand All @@ -101,7 +101,7 @@ public function test_get_invalid_member($id) {
/**
* Test get proxied instance.
*
* @dataProvider test_get_set_testcases()
* @dataProvider get_set_testcases
* @param int $id Object ID.
*/
public function test_get_proxied_instance($id) {
Expand All @@ -115,7 +115,7 @@ public function test_get_proxied_instance($id) {
/**
* Test cases for proxying test.
*/
public function test_proxy_testcases() {
public function proxy_testcases() {
return [
'Object 1 member 1' => [
1,
Expand Down Expand Up @@ -153,7 +153,7 @@ public function test_proxy_testcases() {
/**
* Test cases for getting and setting tests.
*/
public function test_get_set_testcases() {
public function get_set_testcases() {
return [
'Object 1' => [1],
'Object 2' => [5]
Expand Down
15 changes: 4 additions & 11 deletions filter/mathjaxloader/tests/filter_test.php
Expand Up @@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Provides the {@link filter_mathjaxloader_filter_testcase} class.
*
* @package filter_mathjaxloader
* @category test
* @copyright 2017 David Mudrák <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace filter_mathjaxloader;

use filter_mathjaxloader;
Expand All @@ -35,6 +26,8 @@
/**
* Unit tests for the MathJax loader filter.
*
* @package filter_mathjaxloader
* @category test
* @copyright 2017 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -46,7 +39,7 @@ class filter_test extends \advanced_testcase {
* @param string $moodlelangcode the user's current language
* @param string $mathjaxlangcode the mathjax language to be used for the moodle language
*
* @dataProvider test_map_language_code_expected_mappings
* @dataProvider map_language_code_expected_mappings
*/
public function test_map_language_code($moodlelangcode, $mathjaxlangcode) {

Expand All @@ -59,7 +52,7 @@ public function test_map_language_code($moodlelangcode, $mathjaxlangcode) {
*
* @return array of [moodlelangcode, mathjaxcode] tuples
*/
public function test_map_language_code_expected_mappings() {
public function map_language_code_expected_mappings() {

return [
['cz', 'cs'], // Explicit mapping.
Expand Down
4 changes: 2 additions & 2 deletions filter/mathjaxloader/tests/filtermath_test.php
Expand Up @@ -38,7 +38,7 @@ class filtermath_test extends \advanced_testcase {
* @param string $inputtext The text given by the user.
* @param string $expected The expected output after filtering.
*
* @dataProvider test_math_filtering_inputs
* @dataProvider math_filtering_inputs
*/
public function test_math_filtering($inputtext, $expected) {
$filter = new filter_mathjaxloader(\context_system::instance(), []);
Expand All @@ -50,7 +50,7 @@ public function test_math_filtering($inputtext, $expected) {
*
* @return array of [inputtext, expectedoutput] tuples.
*/
public function test_math_filtering_inputs() {
public function math_filtering_inputs() {
return [
// One inline formula.
['Some inline math \\( y = x^2 \\).',
Expand Down
22 changes: 7 additions & 15 deletions h5p/tests/framework_test.php
Expand Up @@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Testing the H5PFrameworkInterface interface implementation.
*
* @package core_h5p
* @category test
* @copyright 2019 Mihail Geshoski <mihail@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace core_h5p;

use core_collator;
Expand All @@ -34,6 +25,7 @@
* Test class covering the H5PFrameworkInterface interface implementation.
*
* @package core_h5p
* @category test
* @copyright 2019 Mihail Geshoski <mihail@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @runTestsInSeparateProcesses
Expand Down Expand Up @@ -638,7 +630,7 @@ public function test_getLibraryId_non_existent_minor_version() {
/**
* Test the behaviour of isPatchedLibrary().
*
* @dataProvider test_isPatchedLibrary_provider
* @dataProvider isPatchedLibrary_provider
* @param array $libraryrecords Array containing data for the library creation
* @param array $testlibrary Array containing the test library data
* @param bool $expected The expectation whether the library is patched or not
Expand All @@ -660,7 +652,7 @@ public function test_isPatchedLibrary(array $libraryrecords, array $testlibrary,
*
* @return array
*/
public function test_isPatchedLibrary_provider(): array {
public function isPatchedLibrary_provider(): array {
return [
'Unpatched library. No different versioning' => [
[
Expand Down Expand Up @@ -1416,7 +1408,7 @@ public function test_loadLibrary_non_existent_library() {
/**
* Test the behaviour of loadLibrarySemantics().
*
* @dataProvider test_loadLibrarySemantics_provider
* @dataProvider loadLibrarySemantics_provider
* @param array $libraryrecords Array containing data for the library creation
* @param array $testlibrary Array containing the test library data
* @param string $expected The expected semantics value
Expand All @@ -1439,7 +1431,7 @@ public function test_loadLibrarySemantics(array $libraryrecords, array $testlibr
*
* @return array
*/
public function test_loadLibrarySemantics_provider(): array {
public function loadLibrarySemantics_provider(): array {

$semantics = json_encode(
[
Expand Down Expand Up @@ -2208,7 +2200,7 @@ public function test_getLibraryContentCount() {
/**
* Test the behaviour of test_libraryHasUpgrade().
*
* @dataProvider test_libraryHasUpgrade_provider
* @dataProvider libraryHasUpgrade_provider
* @param array $libraryrecords Array containing data for the library creation
* @param array $testlibrary Array containing the test library data
* @param bool $expected The expectation whether the library is patched or not
Expand All @@ -2230,7 +2222,7 @@ public function test_libraryHasUpgrade(array $libraryrecords, array $testlibrary
*
* @return array
*/
public function test_libraryHasUpgrade_provider(): array {
public function libraryHasUpgrade_provider(): array {
return [
'Lower major version; Identical lower version' => [
[
Expand Down

0 comments on commit f28a05b

Please sign in to comment.