3 namespace Drupal\Tests\views\Functional\Handler;
5 use Drupal\Tests\views\Functional\ViewTestBase;
6 use Drupal\views\Entity\View;
9 * Tests the title area handler with a web test.
12 * @see \Drupal\views\Plugin\views\area\Title
14 class AreaTitleWebTest extends ViewTestBase {
17 * Views used by this test.
21 public static $testViews = ['test_area_title'];
26 protected function setUp($import_test_views = TRUE) {
27 parent::setUp($import_test_views);
29 $this->enableViewsTestModule();
33 * Tests the title area handler.
35 public function testTitleText() {
36 // Confirm that the view has the normal title before making the view return
38 $this->drupalGet('test-area-title');
39 $this->assertTitle('test_title_header | Drupal');
41 // Change the view to return no result.
42 /** @var \Drupal\views\Entity\View $view */
43 $view = View::load('test_area_title');
44 $display =& $view->getDisplay('default');
45 $display['display_options']['filters']['name'] = [
48 'table' => 'views_test_data',
49 'relationship' => 'none',
50 'plugin_id' => 'string',
51 // Add a value which does not exist. The dataset is defined in
52 // \Drupal\views\Tests\ViewTestData::dataSet().
57 $this->drupalGet('test-area-title');
58 $this->assertTitle('test_title_empty | Drupal');
60 // Change the view to return a result instead.
61 /** @var \Drupal\views\Entity\View $view */
62 $view = View::load('test_area_title');
63 $display =& $view->getDisplay('default');
64 $display['display_options']['filters']['name'] = [
67 'table' => 'views_test_data',
68 'relationship' => 'none',
69 'plugin_id' => 'string',
70 // Change to a value which does exist. The dataset is defined in
71 // \Drupal\views\Tests\ViewTestData::dataSet().
76 $this->drupalGet('test-area-title');
77 $this->assertTitle('test_title_header | Drupal');