You are here

public function PhpUnitWarningsTest::testAssertNotContains in Drupal 9

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);
}