This fixes various (not all) wrong @covers annotations that
are reported as warnings by PHPUnit when it's run with
code-coverage enabled.
When possible, the preferred solution is to change to
@covers at class level, that is the recommended way.
If multiple classes are involved, then a mix of @coversDefaultClass
and @covers at method level are used (always trying to use the
minimum needed patch).
This is the first of a series of issues created as sub-tasks
of MDL-82142.
All setUp(), tearDown(), setUpBeforeClass() and tearDownAfterClass()
must, always, call to parent, to ensure that everything is properly
set and cleaned.
While in a lot of situations this is not needed (parents may not
have anything to run), with PHPUnit >= 10 this can become more
important because we are going to move the reset code from current
placement @ runBare() to setUp()/tearDown().
Note that all the changes performed in this commit have been detected
and fixed by moodle-cs (ParentSetUpTearDownSniffTest).
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.
The changes here are heterogeneous:
- Include stuff that is not available (other test has included it).
Sometimes local to a unit test, others in setupBeforeClass() or
globally, ... depends on every case.
- Rename some tests (namespaces, test name, ...) towards getting it
running.
- Amend small bits here and there.
Important note: I've left any "cosmetic" warning out from the
changes, only a few errors (like long array syntax) have been fixed.
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.
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
Some extra options have been added to the activitychoosertabmode setting, to let
admins decide when to display the Recommended tab.
Apart from that, one of these values have be set as default value for this setting,
as suggested by the UX/PX teams. So the Starter and Full presets have been updated
too with the new values.
The assumption that the settings checkbox always stores boolean values
(e.g. 0/1) isn't correct. The `perfdebug` configuration instead uses
the values 7/15.
In order to guarantee all the plugin type names are displayed properly,
the 'pluginname' string call has been replaced to the proper
$plugininfo->displayname setting. That way, the plugin names will
be always displayed using the proper string translation.
Before applying a preset, the settings are displayed and, in some cases,
the Current/New value columns were empty.
This patch fixes it and guarantees this information is updated properly
every time the set_value() method is called.
This is the list of changes applied to the Starter preset, following
the community suggestions and the latest features included in 4.0:
- Hide Online users, Recently accessed courses and Starred courses.
- Re-enable Description and Essay question types.
- Disable guest enrolment and hide guest login button.
- Reduce the information displayed in the activity chooser.
Apart from that, the User menu items has been removed because it had
the same value in both presets (so it makes no sense having there).
This commit moves the presets subsystem to a location within the admin
folder, which is more appropriate given its purpose and reduces
developer frustration with tab completion of the admin directory.