protected function AssertContentTrait::removeWhiteSpace in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::removeWhiteSpace()
- 9 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::removeWhiteSpace()
Removes all white-space between HTML tags from the raw content.
White-space is only removed if there are no non-white-space characters between HTML tags.
Use this (once) after performing an operation that sets new raw content, and when you want to use e.g. assertText() but ignore potential white-space caused by HTML output templates.
1 call to AssertContentTrait::removeWhiteSpace()
- RenderTest::testRenderChildren in core/
tests/ Drupal/ KernelTests/ Core/ Render/ RenderTest.php - Ensures that render array children are processed correctly.
File
- core/
tests/ Drupal/ KernelTests/ AssertContentTrait.php, line 93
Class
- AssertContentTrait
- Provides test methods to assert content.
Namespace
Drupal\KernelTestsCode
protected function removeWhiteSpace() {
$this->content = preg_replace('@>\\s+<@', '><', $this->content);
$this->plainTextContent = NULL;
$this->elements = NULL;
}