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

@ -199,6 +199,6 @@ class core_grade_import_lib_test extends advanced_testcase {
$output = ob_get_contents();
ob_end_clean();
$this->assertTrue($status);
$this->assertContains("++ Grade import success ++", $output);
$this->assertStringContainsString("++ Grade import success ++", $output);
}
}

View file

@ -274,13 +274,13 @@ class core_grade_report_graderlib_testcase extends advanced_testcase {
// The second row should contain 2 cells - one for the graded quiz and course total.
$this->assertCount(2, $result[1]->cells);
$this->assertContains('NormalQuiz', $result[1]->cells[0]->text);
$this->assertContains('Course total', $result[1]->cells[1]->text);
$this->assertStringContainsString('NormalQuiz', $result[1]->cells[0]->text);
$this->assertStringContainsString('Course total', $result[1]->cells[1]->text);
// User row should contain grade values '-'.
$this->assertCount(2, $result[2]->cells);
$this->assertContains('>-<', $result[2]->cells[0]->text);
$this->assertContains('>-<', $result[2]->cells[1]->text);
$this->assertStringContainsString('>-<', $result[2]->cells[0]->text);
$this->assertStringContainsString('>-<', $result[2]->cells[1]->text);
// Supposing the user cannot view hidden grades, this shouldn't make any difference (due
// to a bug, it previously did).