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

@ -327,7 +327,7 @@ class core_blog_events_testcase extends advanced_testcase {
'relateduserid' => 2,
'other' => array('associateid' => 2 , 'blogid' => 3, 'subject' => 'blog subject')));
} catch (coding_exception $e) {
$this->assertContains('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
$this->assertStringContainsString('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
}
try {
\core\event\blog_association_created::create(array(
@ -336,7 +336,7 @@ class core_blog_events_testcase extends advanced_testcase {
'relateduserid' => 2,
'other' => array('associateid' => 2 , 'blogid' => 3, 'associatetype' => 'random', 'subject' => 'blog subject')));
} catch (coding_exception $e) {
$this->assertContains('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
$this->assertStringContainsString('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage());
}
// Make sure associateid validations work.
try {
@ -346,7 +346,7 @@ class core_blog_events_testcase extends advanced_testcase {
'relateduserid' => 2,
'other' => array('blogid' => 3, 'associatetype' => 'course', 'subject' => 'blog subject')));
} catch (coding_exception $e) {
$this->assertContains('The \'associateid\' value must be set in other.', $e->getMessage());
$this->assertStringContainsString('The \'associateid\' value must be set in other.', $e->getMessage());
}
// Make sure blogid validations work.
try {
@ -356,7 +356,7 @@ class core_blog_events_testcase extends advanced_testcase {
'relateduserid' => 2,
'other' => array('associateid' => 3, 'associatetype' => 'course', 'subject' => 'blog subject')));
} catch (coding_exception $e) {
$this->assertContains('The \'blogid\' value must be set in other.', $e->getMessage());
$this->assertStringContainsString('The \'blogid\' value must be set in other.', $e->getMessage());
}
// Make sure blogid validations work.
try {
@ -366,7 +366,7 @@ class core_blog_events_testcase extends advanced_testcase {
'relateduserid' => 2,
'other' => array('blogid' => 3, 'associateid' => 3, 'associatetype' => 'course')));
} catch (coding_exception $e) {
$this->assertContains('The \'subject\' value must be set in other.', $e->getMessage());
$this->assertStringContainsString('The \'subject\' value must be set in other.', $e->getMessage());
}
}