moodle/cohort/tests
Eloy Lafuente (stronk7) 3dd26fe334 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:07:31 +01:00
..
behat MDL-67668 behat: Update tests for inplace editable field type 2020-11-23 09:00:46 +08:00
fixtures MDL-64506 phpunit: Update unit tests to use classic 2019-04-03 19:34:20 +08:00
cohortlib_test.php MDL-67673 phpunit: Remove expectedException annotations 2020-10-21 12:46:05 +02:00
externallib_test.php MDL-67673 phpunit: Remove deprecated assertContains() uses on strings 2020-10-21 12:46:05 +02:00
privacy_test.php MDL-71036 phpunit: assertContains() now performs strict comparison 2021-03-11 23:07:31 +01:00