function AssertContentTrait::setRawContent

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::setRawContent()
  2. 10 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::setRawContent()
  3. 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\KernelTests

Code

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.