function RendererTest::testRenderSortingWithSetHashSorted
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderSortingWithSetHashSorted()
- 8.9.x core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderSortingWithSetHashSorted()
- 10 core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderSortingWithSetHashSorted()
@covers ::render @covers ::doRender
File
-
core/
tests/ Drupal/ Tests/ Core/ Render/ RendererTest.php, line 525
Class
- RendererTest
- @coversDefaultClass \Drupal\Core\Render\Renderer @group Render
Namespace
Drupal\Tests\Core\RenderCode
public function testRenderSortingWithSetHashSorted() : void {
$first = $this->randomMachineName();
$second = $this->randomMachineName();
// The same array structure again, but with #sorted set to TRUE.
$elements = [
'second' => [
'#weight' => 10,
'#markup' => $second,
],
'first' => [
'#weight' => 0,
'#markup' => $first,
],
'#sorted' => TRUE,
];
$output = (string) $this->renderer
->renderRoot($elements);
// The elements should appear in output in the same order as the array.
$this->assertLessThan(strpos($output, $first), strpos($output, $second));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.