function TableTest::testThemeTableHeaderRenderArray
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableHeaderRenderArray()
- 8.9.x core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableHeaderRenderArray()
- 10 core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableHeaderRenderArray()
Tests header elements with a mix of string and render array values.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Render/ Element/ TableTest.php, line 228
Class
- TableTest
- Tests built-in table theme functions.
Namespace
Drupal\KernelTests\Core\Render\ElementCode
public function testThemeTableHeaderRenderArray() : void {
$header = [
[
'data' => [
'#markup' => 'one',
],
],
'two',
[
'data' => [
'#type' => 'html_tag',
'#tag' => 'b',
'#value' => 'three',
],
],
];
$rows = [
[
1,
2,
3,
],
[
4,
5,
6,
],
[
7,
8,
9,
],
];
$table = [
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
'#responsive' => FALSE,
];
$this->render($table);
$this->removeWhiteSpace();
$this->assertRaw('<thead><tr><th>one</th><th>two</th><th><b>three</b></th></tr>', 'Table header found.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.