function AssertContentTrait::assertNoText

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::assertNoText()
  2. 8.9.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::assertNoText()
  3. 11.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::assertNoText()

Passes if the page (with HTML stripped) does not contains the text.

Note that stripping HTML tags also removes their attributes, such as the values of text fields.

Parameters

string $text: Plain text to look for.

string $message: (optional) A message to display with the assertion. Do not translate messages with t(). Use double quotes and embed variables directly in message text, or use sprintf() if necessary. Avoid the use of \Drupal\Component\Render\FormattableMarkup unless you cast the object to a string. If left blank, a default message will be displayed.

See also

\Drupal\KernelTests\AssertContentTrait::assertNoRaw()

8 calls to AssertContentTrait::assertNoText()
AreaEmptyTest::testRenderEmptyHeaderFooter in core/modules/views/tests/src/Kernel/Handler/AreaEmptyTest.php
Tests that the header and footer areas are not rendered if empty.
AreaResultTest::testResultEmpty in core/modules/views/tests/src/Kernel/Handler/AreaResultTest.php
Tests the results area handler.
CommentAdminViewTest::doTestFilters in core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php
Tests comment admin view display.
DisplayApiTest::testFieldEmpty in core/modules/field/tests/src/Kernel/DisplayApiTest.php
Tests that the prepareView() formatter method still fires for empty values.
DisplayApiTest::testFieldItemListView in core/modules/field/tests/src/Kernel/DisplayApiTest.php
Tests the FieldItemListInterface::view() method.

... See full list

File

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

Class

AssertContentTrait
Provides test methods to assert content.

Namespace

Drupal\KernelTests

Code

protected function assertNoText($text, $message = '') : void {
    $this->assertTextHelper($text, $message, NULL, TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.