function TableTest::testThemeTableHeaderCellOption

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

Tests that the 'header' option in cells works correctly.

File

core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php, line 140

Class

TableTest
Tests built-in table theme functions.

Namespace

Drupal\KernelTests\Core\Render\Element

Code

public function testThemeTableHeaderCellOption() {
    $rows = [
        [
            [
                'data' => 1,
                'header' => TRUE,
            ],
            [
                'data' => 1,
                'header' => FALSE,
            ],
            [
                'data' => 1,
            ],
        ],
    ];
    $table = [
        '#type' => 'table',
        '#rows' => $rows,
    ];
    $this->render($table);
    $this->removeWhiteSpace();
    $this->assertRaw('<th>1</th><td>1</td><td>1</td>', 'The th and td tags was printed correctly.');
}

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