class AreaTitleTest
Same name and namespace in other branches
- 11.x core/modules/views/tests/src/Kernel/Handler/AreaTitleTest.php \Drupal\Tests\views\Kernel\Handler\AreaTitleTest
Tests the title area handler.
@group views
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\views\Kernel\Handler\AreaTitleTest implements \Drupal\Tests\views\Kernel\ViewsKernelTestBase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of AreaTitleTest
See also
\Drupal\views\Plugin\views\area\Title
File
-
core/
modules/ views/ tests/ src/ Kernel/ Handler/ AreaTitleTest.php, line 14
Namespace
Drupal\Tests\views\Kernel\HandlerView source
class AreaTitleTest extends ViewsKernelTestBase {
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = [
'test_area_title',
];
/**
* Tests the title area handler.
*/
public function testTitleText() {
$view = Views::getView('test_area_title');
$view->setDisplay('default');
$this->executeView($view);
$view->render();
$this->assertEmpty($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 = [];
$view->render();
$this->assertEquals('test_title_empty', $view->getTitle(), 'The title area should override the title if the result is empty.');
$view->destroy();
$view->setDisplay('page_1');
$this->executeView($view);
$view->render();
$this->assertEquals('test_title_header', $view->getTitle(), '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 = [];
$view->render();
$this->assertEquals('test_title_empty', $view->getTitle(), 'The title area should override the title if the result is empty.');
$view->destroy();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.