You are here

public function AreaTest::testTitleArea in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Handler/AreaTest.php \Drupal\views\Tests\Handler\AreaTest::testTitleArea()

Tests overriding the view title using the area title handler.

File

core/modules/views/src/Tests/Handler/AreaTest.php, line 233
Contains \Drupal\views\Tests\Handler\AreaTest.

Class

AreaTest
Tests the plugin base of the area handler.

Namespace

Drupal\views\Tests\Handler

Code

public function testTitleArea() {
  $view = Views::getView('frontpage');
  $view
    ->initDisplay('page_1');

  // Add the title area handler to the empty area.
  $view->displayHandlers
    ->get('page_1')
    ->overrideOption('empty', array(
    'title' => array(
      'id' => 'title',
      'table' => 'views',
      'field' => 'title',
      'admin_label' => '',
      'empty' => '0',
      'title' => 'Overridden title',
      'plugin_id' => 'title',
    ),
  ));
  $view->storage
    ->enable()
    ->save();
  $this
    ->drupalGet('node');
  $this
    ->assertText('Overridden title', 'Overridden title found.');
}