You are here

protected function AssertContentTrait::setRawContent in Drupal 10

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

18 calls to AssertContentTrait::setRawContent()
AddFeedTest::testBasicFeedAddNoTitle in core/modules/system/tests/src/Kernel/Common/AddFeedTest.php
Tests attaching feeds with paths, URLs, and titles.
CommentAdminViewTest::doTestFilters in core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php
Tests comment admin view display.
CommentUserNameTest::testUsername in core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php
Tests the username formatter.
ExceptionHandlingTest::testExceptionEscaping in core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php
Tests exception message escaping.
ExternalFormUrlTest::testActionUrlBehavior in core/tests/Drupal/KernelTests/Core/Form/ExternalFormUrlTest.php
Tests form behavior.

... See full list

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]);
  }
}