You are here

public function TableTest::testThemeTableFooter in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php \Drupal\KernelTests\Core\Render\Element\TableTest::testThemeTableFooter()

Tests that the 'footer' option works correctly.

File

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

Class

TableTest
Tests built-in table theme functions.

Namespace

Drupal\KernelTests\Core\Render\Element

Code

public function testThemeTableFooter() {
  $footer = [
    [
      'data' => [
        1,
      ],
    ],
    [
      'Foo',
    ],
  ];
  $table = [
    '#type' => 'table',
    '#rows' => [],
    '#footer' => $footer,
  ];
  $this
    ->render($table);
  $this
    ->removeWhiteSpace();
  $this
    ->assertRaw('<tfoot><tr><td>1</td></tr><tr><td>Foo</td></tr></tfoot>', 'Table footer found.');
}