You are here

protected function TreeTableTest::setUp in Views tree 8.2

Parameters

bool $import_test_views: Should the views specified on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.

Overrides TreeTestBase::setUp

File

tests/src/Kernel/Plugin/views/style/TreeTableTest.php, line 25

Class

TreeTableTest
Tests the views tree list style plugin.

Namespace

Drupal\Tests\views_tree\Kernel\Plugin\views\style

Code

protected function setUp($import_test_views = TRUE) {
  parent::setUp($import_test_views);

  // Change view display to use the tree table style.

  /** @var \Drupal\views\ViewEntityInterface $view */
  $view = View::load('views_tree_test');
  $display =& $view
    ->getDisplay('default');
  $display['display_options']['style']['type'] = 'tree_table';
  $display['display_options']['style']['options']['display_hierarchy_column'] = 'name';
  unset($display['display_options']['style']['options']['type']);
  unset($display['display_options']['style']['options']['collapsible_tree']);

  // Display the 'id' column so the table has more than a single column.
  $display['display_options']['fields']['id']['exclude'] = FALSE;
  $view
    ->save();
}