function AssertContentTrait::getTextContent
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::getTextContent()
- 10 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::getTextContent()
- 11.x 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\KernelTestsCode
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.