You are here

protected function AssertContentTrait::setRawContent in Drupal 9

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

49 calls to AssertContentTrait::setRawContent()
AddFeedTest::testBasicFeedAddNoTitle in core/modules/system/tests/src/Kernel/Common/AddFeedTest.php
Tests attaching feeds with paths, URLs, and titles.
AreaEmptyTest::testRenderEmptyHeaderFooter in core/modules/views/tests/src/Kernel/Handler/AreaEmptyTest.php
Tests that the header and footer areas are not rendered if empty.
AreaEntityTest::doTestRender in core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php
Tests rendering the entity area handler.
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.

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