views_handler_area_text.test
1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* @file
* Definition of ViewsHandlerAreaTextTest.
*/
/**
* Tests the text area handler.
*
* @see views_handler_area_text
*/
class ViewsHandlerAreaTextTest extends ViewsSqlTest {
public static function getInfo() {
return array(
'name' => 'Area: Text',
'description' => 'Test the core views_handler_area_text handler.',
'group' => 'Views Handlers',
);
}
public function testAreaText() {
$view = $this->getBasicView();
// add a text header
$string = $this->randomName();
$view->display['default']->handler->override_option('header', array(
'area' => array(
'id' => 'area',
'table' => 'views',
'field' => 'area',
'content' => $string,
),
));
// Execute the view.
$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');
// Empty results, and it shouldn't be displayed .
$this->assertEqual('', $view->display_handler->handlers['header']['area']->render(TRUE), 'No result should lead to no header');
// Empty results, and it should be displayed.
$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');
}
}