public function AreaTitleTest::testTitleText in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Handler/AreaTitleTest.php \Drupal\views\Tests\Handler\AreaTitleTest::testTitleText()
Tests the title area handler.
File
- core/
modules/ views/ src/ Tests/ Handler/ AreaTitleTest.php, line 31 - Contains \Drupal\views\Tests\Handler\AreaTitleTest.
Class
- AreaTitleTest
- Tests the title area handler.
Namespace
Drupal\views\Tests\HandlerCode
public function testTitleText() {
$view = Views::getView('test_area_title');
$view
->setDisplay('default');
$this
->executeView($view);
$view
->render();
$this
->assertFalse($view
->getTitle(), 'The title area does not override the title if the view is not empty.');
$view
->destroy();
$view
->setDisplay('default');
$this
->executeView($view);
$view->result = array();
$view
->render();
$this
->assertEqual($view
->getTitle(), 'test_title_empty', 'The title area should override the title if the result is empty.');
$view
->destroy();
$view
->setDisplay('page_1');
$this
->executeView($view);
$view
->render();
$this
->assertEqual($view
->getTitle(), 'test_title_header', 'The title area on the header should override the title if the result is not empty.');
$view
->destroy();
$view
->setDisplay('page_1');
$this
->executeView($view);
$view->result = array();
$view
->render();
$this
->assertEqual($view
->getTitle(), 'test_title_empty', 'The title area should override the title if the result is empty.');
$view
->destroy();
}