function AssertContentTrait::getTextContent
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::getTextContent()
Retrieves the plain-text content from the current raw content.
1 call to AssertContentTrait::getTextContent()
- 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.