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.
This commit is contained in:
Eloy Lafuente (stronk7)
2020-10-21 12:46:00 +02:00
parent cc1c4de8dc
commit 07c1522d88
+21
View File
@@ -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: