public function AreaTextTest::testAreaText in Views (for Drupal 7) 8.3
File
- lib/Drupal/views/Tests/Handler/AreaTextTest.php, line 31
- Definition of Drupal\views\Tests\Handler\AreaTextTest.
Class
- AreaTextTest
- Tests the text area handler.
Namespace
Drupal\views\Tests\Handler
Code
public function testAreaText() {
$view = $this
->getView();
$string = $this
->randomName();
$view->displayHandlers['default']
->overrideOption('header', array(
'area' => array(
'id' => 'area',
'table' => 'views',
'field' => 'area',
'content' => $string,
),
));
$this
->executeView($view);
$view->display_handler->handlers['header']['area']->options['format'] = $this
->randomString();
$this
->assertEqual(NULL, $view->display_handler->handlers['header']['area']
->render(), 'Non existant format should return nothing');
$view->display_handler->handlers['header']['area']->options['format'] = filter_default_format();
$this
->assertEqual(check_markup($string), $view->display_handler->handlers['header']['area']
->render(), 'Existant format should return something');
$this
->assertEqual('', $view->display_handler->handlers['header']['area']
->render(TRUE), 'No result should lead to no header');
$view->display_handler->handlers['header']['area']->options['empty'] = TRUE;
$this
->assertEqual(check_markup($string), $view->display_handler->handlers['header']['area']
->render(TRUE), 'No result, but empty enabled lead to a full header');
}