You are here

protected function AssertContentTrait::getTextContent in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::getTextContent()
  2. 10 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::getTextContent()

Retrieves the plain-text content from the current raw content.

4 calls to AssertContentTrait::getTextContent()
AssertContentTrait::assertTextHelper in core/tests/Drupal/KernelTests/AssertContentTrait.php
Helper for assertText and assertNoText.
AssertContentTrait::assertTextPattern in core/tests/Drupal/KernelTests/AssertContentTrait.php
Asserts that a Perl regex pattern is found in the plain-text content.
AssertContentTrait::assertUniqueTextHelper in core/tests/Drupal/KernelTests/AssertContentTrait.php
Helper for assertUniqueText and assertNoUniqueText.
TestClass::_getTextContent in core/tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php

File

core/tests/Drupal/KernelTests/AssertContentTrait.php, line 73

Class

AssertContentTrait
Provides test methods to assert content.

Namespace

Drupal\KernelTests

Code

protected function getTextContent() {
  if (!isset($this->plainTextContent)) {
    $raw_content = $this
      ->getRawContent();

    // Strip everything between the HEAD tags.
    $raw_content = preg_replace('@<head>(.+?)</head>@si', '', $raw_content);
    $this->plainTextContent = Xss::filter($raw_content, []);
  }
  return $this->plainTextContent;
}