You are here

public function AreaTest::testTitleArea in Drupal 8

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

Tests overriding the view title using the area title handler.

File

core/modules/views/tests/src/Functional/Handler/AreaTest.php, line 206

Class

AreaTest
Tests the plugin base of the area handler.

Namespace

Drupal\Tests\views\Functional\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', [
    'title' => [
      '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.');
}