function PhpUnitWarningsTest::testAssertNotContains

Tests assertNotContains.

File

core/tests/Drupal/Tests/PhpUnitWarningsTest.php, line 37

Class

PhpUnitWarningsTest
@coversDefaultClass \Drupal\Tests\Traits\PhpUnitWarnings @group legacy

Namespace

Drupal\Tests

Code

public function testAssertNotContains() {
    if (RunnerVersion::getMajor() > 8) {
        $this->markTestSkipped("In PHPUnit 9+, argument 2 passed to PHPUnit\\Framework\\Assert::assertNotContains() must be iterable.");
    }
    $this->expectDeprecation('Using assertNotContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringNotContainsString() or assertStringNotContainsStringIgnoringCase() instead.');
    $this->expectDeprecation('The optional $ignoreCase parameter of assertNotContains() is deprecated and will be removed in PHPUnit 9.');
    $this->assertNotContains('foo', 'bar');
    $this->assertNotContains('FOO', 'bar', '', TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.