-
Improvement
-
Resolution: Fixed
-
Minor
-
5.0
HELP!!! You broke my tests!!!
See the docs for help.
PR: https://github.com/moodle/devdocs/pull/1234
Issue description:
Once all of the preparation tasks are complete we can start to investigate moving to PHPUnit 10+.
Rather than redirecting the runBare methods as we originally anticipated, we are able to make use of the [\PHPUnit\Framework\Attributes\Before]}} and [\PHPUnit\Framework\Attributes\After]}} attributes to configure this.
The main issues encountered were:
- data provider array values must match test method function param names – I originally split this out into a separate issue but quickly realised that this was really tricky to test without the rest of this branch
- PHPunit no longer fails tests on warnings - this was somewhat more complex to fix
- PHPUnit Mocking has changed to no longer allow mocking of a destructor. This means that the original destructor is always called.
As a result of this I had to modify \core\lock\lock to move the current destructor logic to a new release_if_not_released() method which can be mocked and then calling this from the constructor.
I also had to polyfill some removed test helper methods, including:
- assertTag
- getName
- isInIsolation
And update tests for changes to:
- assertEqualsCanonicalizing
Empty data providers now cause a warning, so some dataProviders which were commented out were instead skipped
Finally I discovered that while we removed all uses of setMethods in MDL-71036, several had crept back.
- blocks
-
MDL-84204 Add support for Rector
-
- Open
-
- caused a regression
-
MDL-85180 "Unable to connect to PostgreSQL server" warning on PostgreSQL PHPUnit runs
-
- Open
-
-
MDL-85181 PHPunit failures on Windows and PostgreSQL
-
- Open
-
-
MDL-84639 Replace usage of deprecated getObjectForTrait mocking
-
- Closed
-
- has been marked as being related by
-
MDL-83789 courselib_test::test_course_created_event breaks component comms rules
-
- Open
-
- has to be done before
-
MDL-84344 PHPUnit Modernisation
-
- Open
-
- is blocked by
-
MDL-81308 PHPUnit 9.6: replace withConsecutive() which will be removed in PHPUnit 10
-
- Closed
-
-
MDL-84124 cachestore_redis compressor tests not reset between tests
-
- Closed
-
-
MDL-81521 Make all data provider static
-
- Closed
-
-
MDL-81520 Update existing unit tests to be final
-
- Closed
-
-
MDL-83472 Add void return type/parent setUp calls to remaining unit test methods
-
- Closed
-
- links to