function RenderElementTypesTest::assertElements

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php \Drupal\KernelTests\Core\Render\Element\RenderElementTypesTest::assertElements()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php \Drupal\KernelTests\Core\Render\Element\RenderElementTypesTest::assertElements()
  3. 11.x core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php \Drupal\KernelTests\Core\Render\Element\RenderElementTypesTest::assertElements()

Asserts that an array of elements is rendered properly.

@internal

Parameters

array $elements: The render element array to test.

string $expected_html: The expected markup.

string $message: Assertion message.

2 calls to RenderElementTypesTest::assertElements()
RenderElementTypesTest::testContainer in core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php
Tests system #type 'container'.
RenderElementTypesTest::testHtmlTag in core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php
Tests system #type 'html_tag'.

File

core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php, line 43

Class

RenderElementTypesTest
Tests the rendered markup of core render element types.

Namespace

Drupal\KernelTests\Core\Render\Element

Code

protected function assertElements(array $elements, string $expected_html, string $message) : void {
    $actual_html = (string) \Drupal::service('renderer')->renderRoot($elements);
    $this->assertSame($expected_html, $actual_html, Html::escape($message));
}

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