You are here

protected function AssertContentTrait::assertText in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::assertText()
  2. 9 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::assertText()

Passes if the page (with HTML stripped) 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: use \Drupal\Component\Render\FormattableMarkup to embed variables in the message text, not t(). If left blank, a default message will be displayed.

string $group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Other'; most tests do not override this default.

See also

\Drupal\KernelTests\AssertContentTrait::assertRaw()

3 calls to AssertContentTrait::assertText()
CommentAdminViewTest::doTestFilters in core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php
Tests comment admin view display.
FieldFieldAccessTestBase::assertFieldAccess in core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php
Checks views field access for a given entity type and field name.
TwigNamespaceTest::testTwigNamespaces in core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php
Tests template extension and includes using namespaces.

File

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

Class

AssertContentTrait
Provides test methods to assert content.

Namespace

Drupal\KernelTests

Code

protected function assertText($text, $message = '', $group = 'Other') : void {
  $this
    ->assertTextHelper($text, $message, $group, FALSE);
}