You are here

protected function AssertContentTrait::removeWhiteSpace in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/AssertContentTrait.php \Drupal\simpletest\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.

12 calls to AssertContentTrait::removeWhiteSpace()
ResponsiveImageFieldDisplayTest::assertResponsiveImageFieldFormattersLink in core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php
Tests responsive image formatters linked to the file or node.
ResponsiveImageFieldDisplayTest::doTestResponsiveImageFieldFormatters in core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php
Test responsive image formatters on node display.
TableTest::testThemeTableFooter in core/modules/system/src/Tests/Theme/TableTest.php
Test that the 'footer' option works correctly.
TableTest::testThemeTableFooter in core/modules/system/src/Tests/Render/Element/TableTest.php
Test that the 'footer' option works correctly.
TableTest::testThemeTableHeaderCellOption in core/modules/system/src/Tests/Theme/TableTest.php
Tests that the 'header' option in cells works correctly.

... See full list

File

core/modules/simpletest/src/AssertContentTrait.php, line 98
Contains \Drupal\simpletest\AssertContentTrait.

Class

AssertContentTrait
Provides test methods to assert content.

Namespace

Drupal\simpletest

Code

protected function removeWhiteSpace() {
  $this->content = preg_replace('@>\\s+<@', '><', $this->content);
  $this->plainTextContent = NULL;
  $this->elements = NULL;
}