function AssertContentTrait::setRawContent

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::setRawContent()
  2. 8.9.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::setRawContent()
  3. 11.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::setRawContent()

Sets the raw content (e.g. HTML).

Parameters

string|\Stringable $content: The raw content to set.

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.