3 namespace Drupal\Tests\views\Kernel\Handler;
5 use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
6 use Drupal\views\Views;
9 * Tests the title area handler.
12 * @see \Drupal\views\Plugin\views\area\Title
14 class AreaTitleTest extends ViewsKernelTestBase {
17 * Views used by this test.
21 public static $testViews = ['test_area_title'];
24 * Tests the title area handler.
26 public function testTitleText() {
27 $view = Views::getView('test_area_title');
29 $view->setDisplay('default');
30 $this->executeView($view);
32 $this->assertFalse($view->getTitle(), 'The title area does not override the title if the view is not empty.');
35 $view->setDisplay('default');
36 $this->executeView($view);
39 $this->assertEqual($view->getTitle(), 'test_title_empty', 'The title area should override the title if the result is empty.');
42 $view->setDisplay('page_1');
43 $this->executeView($view);
45 $this->assertEqual($view->getTitle(), 'test_title_header', 'The title area on the header should override the title if the result is not empty.');
48 $view->setDisplay('page_1');
49 $this->executeView($view);
52 $this->assertEqual($view->getTitle(), 'test_title_empty', 'The title area should override the title if the result is empty.');