You are here

public function AreaTest::testTitleArea in Views (for Drupal 7) 8.3

Tests overriding the view title using the area title handler.

File

lib/Drupal/views/Tests/Handler/AreaTest.php, line 115
Definition of Drupal\views\Tests\Handler\AreaTest.

Class

AreaTest
Tests the abstract area handler.

Namespace

Drupal\views\Tests\Handler

Code

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

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