MDL-67673 phpunit: Remove deprecated assertContains() uses on strings

Both assertContains() and assertNotContains() are deprecated in PHPUnit 8
for operations on strings. Also the optional case parameter is. All uses
must be changed to one of:

- assertStringContainsString()
- assertStringContainsStringIgnoringCase()
- assertStringNotContainsString()
- assertStringNotContainsStringIgnoringCase()

More info: https://github.com/sebastianbergmann/phpunit/issues/3422

Regexp to find all uses:

ag 'assert(Not)?Contains\('
This commit is contained in:
Eloy Lafuente (stronk7) 2020-09-01 00:44:13 +02:00
parent 106c64ac24
commit 35bc26b516
113 changed files with 720 additions and 720 deletions

View file

@ -309,7 +309,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
core_cohort_external::update_cohorts(array($cohort1));
$this->fail('Expecting invalid_parameter_exception exception, none occured');
} catch (invalid_parameter_exception $e1) {
$this->assertContains('Invalid external api parameter: the value is "THIS IS NOT AN ID"', $e1->debuginfo);
$this->assertStringContainsString('Invalid external api parameter: the value is "THIS IS NOT AN ID"', $e1->debuginfo);
}
$cohort1['id'] = 9.999; // Also not a valid id of a cohort.
@ -317,7 +317,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
core_cohort_external::update_cohorts(array($cohort1));
$this->fail('Expecting invalid_parameter_exception exception, none occured');
} catch (invalid_parameter_exception $e2) {
$this->assertContains('Invalid external api parameter: the value is "9.999"', $e2->debuginfo);
$this->assertStringContainsString('Invalid external api parameter: the value is "9.999"', $e2->debuginfo);
}
}