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.
* An image with non-empty alt text should not have a presentation role.
* An empty alt attribute is sufficient for decorative images. No need to
add a presentation role for them.
* Additionally, if there is already text that is present for an image,
there's no need to add an alt text with the same text. Such images are
decorative and should just have an empty alt text.
This resolves accessibility issues where Moodle language pack codes
didn't always map to correspondingly named iso6391 codes.
Where this value is defined in the language configuration, it will
now be used.
The problem is that HTML Purifier is not compatible with Markdown,
that means we cannot sanitise Markdown texts before editing.
Luckily Markdown has to use plain text editor which does not have
XSS problems.
The only tiny downside is that Markdown cannot be allowed
in "trust text" areas any more.
Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when
the expression inside the braces resolves to a variable or an expression.
In PHPUnit 9.1, the following regexp-related assertions
have been deprecated and there are new alternatives for
all them:
- assertRegExp() -> assertMatchesRegularExpression()
- assertNotRegExp() -> assertDoesNotMatchRegularExpression()
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 'assertRegExp|assertNotRegExp' -li
get_file_argument() is responsible to extract the relative path
of the file to be served by a specific Moodle component
like a theme or a module.
Some modules like scorm and imscp require slasharguments support
and they force it when creating the URLs to serve their files.
It should honor the slasharguments setting but this could break
those instances where existing hard-coded links still make usage of
the "old" format, the one when slasharguments is set to No i.e. '?file='.
Its logic has been improved by looking at when the URL is related to
serving a plug-in file in a "forced" slasharguments way of serving it
i.e. using '/pluginfile.php/' and not '/pluginfile.php?'.
It was discovered by unit tests that the return value is not a real
boolean as was intuitively expected and documented. To avoid potential
issues with the truthyness in the future, we explicitly cast the return
value to boolean now.
The patch adds validation for the noreplyaddress setting variable, for
the explicit $replyto parameter and for the sender's email. In case of
misconfigured noreplyaddress setting, it falls back to the default
noreply address value. In case of invalid email in the user's record,
the email is not sent.
The patch also adds unit test for the value returned by the function
generate_email_processing_address() so that it can be considered as a
valid email, too.
This is supposed to significantly minimise the risk of exploiting the
vulnerability in PHPMailer's Sender field.
The s() function includes a comment saying that parameter options
should be modified to improve performance once PHP 5.4 is required.
Since Moodle has required PHP 5.4 for some time, we should probably
make the change and remove the comment.
According to my benchmarking, these changes make s() about 7% faster
and will save a staggering 2ms from a typical course view that calls
it 8,000 times.
1. getMock()
2. setExpectedException()
3. checkForUnintentionallyCoveredCode renamed to beStrictAboutCoversAnnotation
4. beStrictAboutTestSize renamed to enforceTimeLimit
5. UnitTestCase class is now fully removed.
The upgraded version of HTML2Text highlighted some bugs in our unit tests.
In the IOS test, the HTML content includes a couple of patches of
In the previous version of HTML2Text, these were being converted to
breaking spaces. In one of these cases, it was then removed due to a trim.
The expected texts have been converted to use the correct non-breaking spaces.
In the case of the trimmed one, it is no longer trimmed as non-breaking
spaces are not trimmed.
This gives a truer reflection of the actual text.
In the case of the Outlook test, this trailing whitespace is not present in
the source. It was likely caused by a bug in the previous version of
HTML2Text.
In the case of the weblib change, the test was just wrong. Both of the
actual characters are encodings for an HTML bullet (decimal and hex) and
should both be converted to the relevant UTF8 representation of this
bullet.