While this change is not 100% required now, it's good habit
and we are checking for it since Moodle 4.4.
All the changes in this commit have been applied automatically
using the moodle.PHPUnit.TestReturnType sniff and are, exclusively
adding the ": void" return types when missing.
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing
All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.
Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
This just deletes all the upgrade steps previous to 3.9.0. Some
small adjustments, like tweaking globals can also be applied
when needed.
Also includes an upgrade step to prevent upgrading from any
version < 2020061500 (v3.9.0) as anti-cheating measure.
The next commits will proceed to deprecate / remove functions
that were exclusively (usually belonging to upgradelib) being
used by those, now removed, upgrade steps. This is the list
of code to remove and document in upgrade.txt files:
- upgrade_analytics_fix_contextids_defaults()
- upgrade_convert_hub_config_site_param_names()
- upgrade_rename_prediction_actions_useful_incorrectly_flagged()
- \mod_forum\task\refresh_forum_post_counts adhoc task.
And these is the code that has NOT been removed
because it may be needed later (no matter there aren't uses now):
- \core_search\manager::clean_up_non_existing_area(), used by
- \core\task\clean_up_deleted_search_area_task adhoc task
Applied the following changes to various testcase classes:
- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.
Special mention to:
- Moved to the level2 "privacy" namespace:
- \mod_assign\privacy\feedback_legacy_polyfill_test
- \mod_assign\privacy\submission_legacy_polyfill_test
- Moved to the level2 "task" namespace:
- \core_message\task\migrate_message_data_test
- \ltiservice_gradebookservices\task\cleanup_test
- \message_email\task\send_email_test
- \mod_lti\task\clean_access_tokens_test
- \mod_workshop\task\cron_task_test
- Moved to the level2 "event" namespace:
- \core_h5p\event\deleted_test
- \core_h5p\event\viewed_test
- Renamed to a better name:
- backup_forum_activity_task_test.php (missing "task")
The current ->setMethods() has been silently (won't emit any
warning) in PHPUnit 9. And will stop working (current plans)
in PHPUnit 10.
Basically the now deprecated method has been split into:
- onlyMethods(): To point to existing methods in the mocked artifact.
- addMethods(): To point to non existing (yet) methods in the mocked
artifact.
In practice that means that all our current setMethods() calls can be
converted to onlyMethods() (existing) and done. The addMethods() is
mostly useful on development phases, not final testing.
Finally note that <null> isn't accepted anymore as parameter to
double all the methods. Instead empty array [] must be used.
Link: https://github.com/sebastianbergmann/phpunit/issues/3770
In PHPUnit 9.1, the following file-related assertions
have been deprecated and there are new alternatives for
all them:
- assertNotIsReadable() -> assertIsNotReadable()
- assertNotIsWritable() -> assertIsNotWritable()
- assertDirectoryNotExists() -> assertDirectoryDoesNotExist()
- assertDirectoryNotIsReadable()-> assertDirectoryIsNotReadable()
- assertDirectoryNotIsWritable()-> assertDirectoryIsNotWritable()
- assertFileNotExists() -> assertFileDoesNotExist()
- assertFileNotIsReadable() -> assertFileIsNotReadable()
- assertFileNotIsWritable() -> assertFileIsNotWritable()
This is about to, simply, move all cases to the new alternatives.
Source: https://github.com/sebastianbergmann/phpunit/blob/9.1.0/ChangeLog-9.1.md
Regexp to find all them:
ag 'assertNotIsReadable|assertNotIsWritable|assertDirectoryNotExists|\
assertDirectoryNotIsReadable|assertDirectoryNotIsWritable|\
assertFileNotExists|assertFileNotIsReadable|assertFileNotIsWritable'
This just deletes all the upgrade steps previous to 3.6.0. Some
small adjustments, like tweaking globals can also be applied
when needed.
Also includes an upgrade step to prevent upgrading from any
version < 2018120300 (v3.6.0) as anti-cheating measure.
Note that in this case, there wasn't any case of upgradelib
functions being used, hence we haven't to deprecate/remove
anything in codebase. When there is such a need, that is done
in separate commits (one for each function) and documented here.
See MDL-65809 commits for an example removing/deprecating a
good number of functions.
All the setup/teardown/pre/post/conditions template methods
now are required to return void. This was warned with phpunit 7
and now is enforced.
At the same time, fix a few wrong function names,
provider data and param types, return statements...
version = 2021052500 release version
requires= 2021052500 same than version
Why 20210525? (25th May 2021) ?
Because master is going to be Moodle 4.0, to be released
on November 2021. And, until then, we are going to have
a couple of "intermediate" releases:
- Moodle 3.10 to be released 9th November 2020. (2020110900)
This version will be using versions from today to 2020110900
(once it's released the YYYYMMDD part stops advancing).
- Moodle 3.11 to be released 10th May 2021. (2021051000)
This version will be using versions from 3.10 release to 2021051000
(once it's released the YYYYMMDD part stops advancing).
That means that all versions from today to 2021051000 are going
to be used by those 2 "intermediate" releases (3.10 and 3.11).
And we cannot use them in master, because it's forbidden to have
any overlapping of versions between branches (or different upgrade
paths will fail).
So, get that 2021051000, let's add it a couple of weeks to cover
the on-sync period (or a 2 weeks delay max!) and, the first version
that master can "own" in exclusive (without any overlap) is, exactly,
25th May 2021, hence our 20210525.
Significant string changes:
* pluginnamesummary,qtype_ddimageortext and
pluginnamesummary,qtype_ddmarker - Note about the question type not
being accessible to visually impaired users
* addresourceoractivity,core - Removing 'resource' as the new activity
chooser doesn't have resource types separated
Significant string changes:
* configcustommenuitems,core_admin - corrected example
* custommenuitems_desc,tool_mobile - fallback behaviour of custom menu
items in the app
If 'unix' is the first element of the stream_get_transports() result
array, array_search() will return `0` as index result which, when
negated, will result as true.
This just deletes all the upgrade steps previous to 3.5.0. Some
small adjustments, like tweaking globals can also be applied
when needed.
Also includes an upgrade step to prevent upgrading from any
version < 2018051700 (v3.5.0) as anti-cheating measure.
Previous commits have removed/deprecated all the upgradelib functions
not used anymore in codebase. Deletion has been documented in corresponding
upgrade.txt files:
- upgrade_fix_block_instance_configuration()
- upgrade_theme_is_from_family(), upgrade_find_theme_location()
and linkcoursesectionsupgradescriptwasrun setting
- upgrade_block_positions
- upgrade_fix_config_auth_plugin_names()
and upgrade_fix_config_auth_plugin_defaults()
- format_xxx_upgrade_remove_numsections(), format_xxx_upgrade_hide_extra_sections()
and format_xxx_upgrade_add_empty_sections()
- filter_mathjaxloader_upgrade_cdn_cloudflare()
and filter_mathjaxloader_upgrade_mathjaxconfig_equal()
- get_assignments_with_rescaled_null_grades()
These have been kept because continue being used by restore:
- \core\task\refresh_mod_calendar_events_task
3.7 (min PHP 7.1) requires 3.2 (first version supporting PHP 7.1)
This just deletes all the upgrade steps previous to 3.2.0. Some
small adjustments, like adding missing MOODLE_INTERNAL or tweaking
globals can also be applied when needed.
Also includes an upgrade step to prevent upgrading from any
version < 2016120500 (v3.2.0) as anti-cheating measure.
Next commit will get rid of/deprecate all the upgradelib functions
not used anymore in codebase. (note there isn't any this time).