function AssertContentTrait::setRawContent
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::setRawContent()
- 10 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::setRawContent()
- 8.9.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::setRawContent()
Sets the raw content (e.g. HTML).
Parameters
string $content: The raw content to set.
3 calls to AssertContentTrait::setRawContent()
- AreaMessagesTest::testMessageText in core/
modules/ views/ tests/ src/ Kernel/ Handler/ AreaMessagesTest.php - Tests the messages area handler.
- CommentAdminViewTest::doTestFilters in core/
modules/ comment/ tests/ src/ Kernel/ Views/ CommentAdminViewTest.php - Tests comment admin view display.
- WorkspaceIntegrationTest::assertWorkspaceStatus in core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceIntegrationTest.php - Checks entity load, entity queries and views results for a test scenario.
File
-
core/
tests/ Drupal/ KernelTests/ AssertContentTrait.php, line 60
Class
- AssertContentTrait
- Provides test methods to assert content.
Namespace
Drupal\KernelTestsCode
protected function setRawContent($content) {
$this->content = $content;
$this->plainTextContent = NULL;
$this->elements = NULL;
$this->drupalSettings = [];
if (preg_match('@<script type="application/json" data-drupal-selector="drupal-settings-json">([^<]*)</script>@', $content, $matches)) {
$this->drupalSettings = Json::decode($matches[1]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.