The only tests that have COMPLETE* support for the debugging sink
are the advanced_testcase and the database_driver ones (store and
report). So we must ensure that the rest of tests don't use the
debugging sink at all.
Right now we are using it for storing, but later there is not
reporting, so any debugging happening within non advanced tests
is not detected.
This commit just ensures that we stop making that storing for
non advanced/database_driver tests. Nothing more, nothing less.
* Note that we have had to add a few missing bits to the
database_driver testcase because it was not 100% complete. Now
it behaves 100% the same than the advanced_testcase one regarding
the debugging sink.
This patch fixes the following error:
PHP Deprecated: explode(): Passing null to parameter #2 ($string)
of type string is deprecated in lib/upgradelib.php on line 1299
Most types of form field will now include aria-required="true" if the
field is marked as required. This causes assistive technology to inform
users that the field is required.
Before this change, in some cases (e.g. screen reader users tabbing
through fields) users were not informed that a field is required.
The ERROR event is defined as being fired if an exception occurs while
contacting the server. This change ensures it is fired for exceptions
in the form definition AJAX request, not just form submission.
Additionally, if such an error occurs in submission, the form buttons
were left in disabled state. This change makes them enabled again.
Now that PHP has support for named parameters, and we can use them in
Moodle, we should ditch `$options` arrays and use first-class,
documented, parameters.
Whilst this may seem scary, dumb, overwhelming, please note that you do
not need to supply all args, for example, to change the last parameter
of `format_text` you no longer need to do this:
return \core\container::get(\core\formatting::class)->format_text(
$text,
FORMAT_MOODLE,
$context,
false,
null,
true,
true,
true,
false,
false,
true,
);
Instead you can do:
return \core\container::get(\core\formatting::class)->format_text(
$text,
FORMAT_MOODLE,
$context,
allowid: true,
);
Or better still:
return \core\container::get(\core\formatting::class)->format_text(
text: $text,
format: FORMAT_MOODLE,
context: $context,
allowid: true,
);
This means that we can get defaults in the function signature, improves
our typing, and allows for deprecation and changes to options. It also
sets us up for success in the future.
The \core\di class is a Moodle wrapper to php-di which is intended to
allow Moodle to switch to an alternate DI solution in the future if
required. All interaction with the container uses the PSR-11 Container
interfaces, which allows for normalisation of configuration, setting,
and retrieving of DI container-identified classes.