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).
This commit includes more changes, all them also adding the :void
return type to unit tests missing them.
The difference is that all these changes, while also detected
perfectly by the moodle.PHPUnit.TestReturnType sniff, were not
auto-fixed (like the previous commit ones), because all them
do include some "return" statement and, for safety, we don't
fix them.
All the cases have been visually inspected and confirmed that
the existing "return" statements always belong to anon
functions within the test body and not the test own return statement.
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 default option "ASSIGN_ATTEMPT_REOPEN_METHOD_NONE" for the
"attemptreopenmethod" setting, which disallows multiple attempts at the
assignment, has been removed. This option was unnecessary because
limiting attempts to 1 through the "maxattempts" setting achieves the
same behavior.
Apart from removing this setting option (including removal of usage in
code and updating existing data in the DB), these changes include:
- Introducing a more effective progressive disclosure by allowing the
"maxattempts" setting to control the visibility of the
"attemptreopenmethod" setting in the form.
- String improvements to the labels and help text for the "maxattempts"
and "attemptreopenmethod" settings
- Changing the default value of the "maxattempts" setting from
"unlimited" to "1"
Prior to this, a custom grader role that has mod/assign:grade but not
mod/assign:releasegrades or mod/assign:managegrades would see a select
with only the states available to them - not the current state, and
could reset a grade from released to Not marked/In marking/Marking
completed.