function PhpUnitWarningsTest::testAssertContains
Tests assertContains.
File
-
core/
tests/ Drupal/ Tests/ PhpUnitWarningsTest.php, line 24
Class
- PhpUnitWarningsTest
- @coversDefaultClass \Drupal\Tests\Traits\PhpUnitWarnings @group legacy
Namespace
Drupal\TestsCode
public function testAssertContains() {
if (RunnerVersion::getMajor() > 8) {
$this->markTestSkipped("In PHPUnit 9+, argument 2 passed to PHPUnit\\Framework\\Assert::assertContains() must be iterable.");
}
$this->expectDeprecation('Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringContainsString() or assertStringContainsStringIgnoringCase() instead.');
$this->expectDeprecation('The optional $ignoreCase parameter of assertContains() is deprecated and will be removed in PHPUnit 9.');
$this->assertContains('string', 'aaaa_string_aaa');
$this->assertContains('STRING', 'aaaa_string_aaa', '', TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.