You are here

public function AssertContentTraitTest::testGetTextContent in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php \Drupal\Tests\Core\Test\AssertContentTraitTest::testGetTextContent()
  2. 9 core/tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php \Drupal\Tests\Core\Test\AssertContentTraitTest::testGetTextContent()

@covers ::getTextContent

File

core/tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php, line 17

Class

AssertContentTraitTest
@coversDefaultClass \Drupal\KernelTests\AssertContentTrait @group Test

Namespace

Drupal\Tests\Core\Test

Code

public function testGetTextContent() {
  $test = new TestClass();
  $raw_content = <<<EOT

<Head>
<style>
@import url("foo.css");
</style>
</head>
<body>
bar
</body>
EOT;
  $test
    ->_setRawContent($raw_content);
  $this
    ->assertStringNotContainsString('foo', $test
    ->_getTextContent());
  $this
    ->assertStringNotContainsString('<body>', $test
    ->_getTextContent());
  $this
    ->assertStringContainsString('bar', $test
    ->_getTextContent());
}