You are here

public function TableTest::testThemeTableHeaderRenderArray in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/system/src/Tests/Theme/TableTest.php \Drupal\system\Tests\Theme\TableTest::testThemeTableHeaderRenderArray()
  2. 8 core/modules/system/src/Tests/Render/Element/TableTest.php \Drupal\system\Tests\Render\Element\TableTest::testThemeTableHeaderRenderArray()
Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Theme/TableTest.php \Drupal\system\Tests\Theme\TableTest::testThemeTableHeaderRenderArray()

Tests header elements with a mix of string and render array values.

File

core/modules/system/src/Tests/Theme/TableTest.php, line 247
Contains \Drupal\system\Tests\Theme\TableTest.

Class

TableTest
Tests built-in table theme functions.

Namespace

Drupal\system\Tests\Theme

Code

public function testThemeTableHeaderRenderArray() {
  $header = array(
    array(
      'data' => array(
        '#markup' => 'one',
      ),
    ),
    'two',
    array(
      'data' => array(
        '#type' => 'html_tag',
        '#tag' => 'b',
        '#value' => 'three',
      ),
    ),
  );
  $rows = array(
    array(
      1,
      2,
      3,
    ),
    array(
      4,
      5,
      6,
    ),
    array(
      7,
      8,
      9,
    ),
  );
  $table = array(
    '#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.');
}