moodle/blog/tests
Eloy Lafuente (stronk7) 8a14a7bd22 MDL-71036 phpunit: assertContains() now performs strict comparison
The methods assertContains() and assertNotContains() now perform
strict (type and value) comparison, pretty much like assertSame()
does.

A couple of new assertContainsEquals() and assertNotContainsEquals()
methods have been created to provide old (non-strict) behavior, pretty
much like assertEquals() do.

Apart from replacing the calls needing a relaxed comparison to those
new methods, there are also a couple of alternative, about how to
fix this, depending of every case:

- If the test is making any array_values() conversion, then it's better
  to remove that conversion and use assertArrayHasKey(), that is not
  strict.
- Sometimes if may be also possible to, simply, cast the expectation
  to the exact type coming in the array. I've not applied this technique
  to any of the cases in core.

Link: https://github.com/sebastianbergmann/phpunit/issues/3426
2021-03-11 23:04:31 +01:00
..
behat MDL-57281 behat: deprecated step definition I navigate to node in 2018-08-20 12:53:26 +01:00
events_test.php MDL-67673 phpunit: Remove deprecated assertContains() uses on strings 2020-10-21 12:46:00 +02:00
external_test.php MDL-67673 phpunit: Fix the return type of template methods 2020-10-21 12:45:59 +02:00
lib_test.php MDL-67673 phpunit: Fix the return type of template methods 2020-10-21 12:45:59 +02:00
privacy_test.php MDL-71036 phpunit: assertContains() now performs strict comparison 2021-03-11 23:04:31 +01:00