public function TableTest::testThemeTableRowRenderArray in Zircon Profile 8
Same name in this branch
- 8 core/modules/system/src/Tests/Theme/TableTest.php \Drupal\system\Tests\Theme\TableTest::testThemeTableRowRenderArray()
- 8 core/modules/system/src/Tests/Render/Element/TableTest.php \Drupal\system\Tests\Render\Element\TableTest::testThemeTableRowRenderArray()
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Render/Element/TableTest.php \Drupal\system\Tests\Render\Element\TableTest::testThemeTableRowRenderArray()
Tests row elements with a mix of string and render array values.
File
- core/
modules/ system/ src/ Tests/ Render/ Element/ TableTest.php, line 278 - Contains \Drupal\system\Tests\Render\Element\TableTest.
Class
- TableTest
- Tests built-in table theme functions.
Namespace
Drupal\system\Tests\Render\ElementCode
public function testThemeTableRowRenderArray() {
$header = array(
'one',
'two',
'three',
);
$rows = array(
array(
'1-one',
array(
'data' => '1-two',
),
'1-three',
),
array(
array(
'data' => array(
'#markup' => '2-one',
),
),
'2-two',
array(
'data' => array(
'#type' => 'html_tag',
'#tag' => 'b',
'#value' => '2-three',
),
),
),
);
$table = array(
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
'#responsive' => FALSE,
);
$this
->render($table);
$this
->removeWhiteSpace();
$this
->assertRaw('<tbody><tr><td>1-one</td><td>1-two</td><td>1-three</td></tr>', 'Table row 1 found.');
$this
->assertRaw('<tr><td>2-one</td><td>2-two</td><td><b>2-three</b></td></tr></tbody>', 'Table row 2 found.');
}