From 7f20e2071c147d94d9b7a239694422ab4550561e Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Wed, 7 Oct 2020 21:33:38 +0200 Subject: [PATCH] MDL-67673 phpunit: Document all the changes in upgrade.txt This includes: - Breaking changes (return void + PHP 7.1 min requirement). - Deprecations and removals. - Specifically DbUnit and its replacement. - Printer showing how to rerun tests removed. --- lib/upgrade.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/upgrade.txt b/lib/upgrade.txt index e4dbf8768f7..56bd4441e15 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -3,6 +3,27 @@ information provided here is intended especially for developers. === 3.10 === * PHPUnit has been upgraded to 8.5. That comes with a few changes: + - Breaking change: All the "template methods" (setUp(), tearDown()...) now require to return void. This implies + that the minimum version of PHP able to run tests will be PHP 7.1 + - A good number of assertions have been deprecated with this version + and will be removed in a future one. In core all cases have been removed + (so it's deprecation-warnings free). It's recommended to perform the + switch to their new counterparts ASAP: + - assertInternalType() has been deprecated. Use the assertIsXXX() methods instead. + - assertArraySubset() has been deprecated. Use looping + assertArrayHasKey() or similar. + - @expectedExceptionXXX annotations have been deprecated. Use the expectExceptionXXX() + methods instead (and put them exactly before the line that is expected to throw the exception). + - assertAttributeXXX() have been deprecated. If testing public attributes use normal assertions. If + testing non-public attributes... you're doing something wrong :-) + - assertContains() to find substrings on strings has been deprecated. Use assertStringContainsString() instead. + (note that there are "IgnoringCase()" variants to perform case-insensitive matching. + - assertEquals() extra params have been deprecated and new assertions for them created: + - delta => use assertEqualsWithDelta() + - canonicalize => use assertEqualsCanonicalizing() + - ignoreCase => use assertEqualsIgnoringCase() + - maxDepth => removed without replacement. + - The custom printer that was used to show how to rerun a failure has been removed, it was old and "hacky" + solution, for more information about how to run tests, see the docs, there are plenty of options. - phpunit/dbunit is not available any more and it has been replaced by a lightweight phpunit_dataset class, able to load XML/CSV and PHP arrays, send the to database and return rows to calling code (in tests). That implies the follwoing changes in the advanced_testcase class: -- 2.11.4.GIT