function AssertContentTrait::assertText
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::assertText()
- 8.9.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::assertText()
- 10 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.
See also
\Drupal\KernelTests\AssertContentTrait::assertRaw()
17 calls to AssertContentTrait::assertText()
- AreaEmptyTest::testRenderEmptyHeaderFooter in core/
modules/ views/ tests/ src/ Kernel/ Handler/ AreaEmptyTest.php - Tests that the header and footer areas are not rendered if empty.
- AreaMessagesTest::testMessageText in core/
modules/ views/ tests/ src/ Kernel/ Handler/ AreaMessagesTest.php - Tests the messages area handler.
- AreaResultTest::testResult in core/
modules/ views/ tests/ src/ Kernel/ Handler/ AreaResultTest.php - Tests the results area handler.
- 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.
File
-
core/
tests/ Drupal/ KernelTests/ AssertContentTrait.php, line 474
Class
- AssertContentTrait
- Provides test methods to assert content.
Namespace
Drupal\KernelTestsCode
protected function assertText($text, $message = '') : void {
$this->assertTextHelper($text, $message, NULL, FALSE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.