Commit a6c2d42f authored by alexpott's avatar alexpott
Browse files

Issue #2359931 by dawehner: Ensure that empty title support does not break.

parent c999c2d4
......@@ -54,7 +54,7 @@ public function testTitleText() {
$this->executeView($view);
$view->result = array();
$view->render();
$this->assertEqual($view->getTitle(), 'test_title_header', 'The title area on the header should override the title if the result is empty.');
$this->assertEqual($view->getTitle(), 'test_title_empty', 'The title area should override the title if the result is empty.');
$view->destroy();
}
......
<?php
/**
* @file
* Contains \Drupal\views\Tests\Handler\AreaTitleWebTest.
*/
namespace Drupal\views\Tests\Handler;
use Drupal\views\Entity\View;
use Drupal\views\Tests\ViewTestBase;
/**
* Tests the title area handler with a web test.
*
* @group views
* @see \Drupal\views\Plugin\views\area\Title
*/
class AreaTitleWebTest extends ViewTestBase {
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = ['test_area_title'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->enableViewsTestModule();
}
/**
* Tests the title area handler.
*/
public function testTitleText() {
$this->drupalGet('test-area-title');
$this->assertTitle('test_title_header | Drupal');
// Check the view to return no result.
/** @var \Drupal\views\Entity\View $view */
$view = View::load('test_area_title');
$display =& $view->getDisplay('default');
$display['display_options']['filters']['id'] = [
'field' => 'id',
'id' => 'id',
'table' => 'views_test_data',
'relationship' => 'none',
'plugin_id' => 'numeric',
'provider' => 'views_test_data',
// Add a value which does not exist.
'value' => ['value' => '042118160112'],
];
$view->save();
$this->drupalGet('test-area-title');
$this->assertTitle('test_title_empty | Drupal');
}
}
......@@ -46,8 +46,8 @@ display:
position: 0
page_1:
display_options:
path: test-area-title
defaults:
empty: '0'
header: '0'
header:
title:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment