Project

General

Profile

Paste
Download (1.75 KB) Statistics
| Branch: | Revision:

root / drupal7 / sites / all / modules / views / tests / handlers / views_handler_area_text.test @ 4003efde

1
<?php
2

    
3
/**
4
 * @file
5
 * Definition of ViewsHandlerAreaTextTest.
6
 */
7

    
8
/**
9
 * Tests the text area handler.
10
 *
11
 * @see views_handler_area_text
12
 */
13
class ViewsHandlerAreaTextTest extends ViewsSqlTest {
14
  public static function getInfo() {
15
    return array(
16
      'name' => 'Area: Text',
17
      'description' => 'Test the core views_handler_area_text handler.',
18
      'group' => 'Views Handlers',
19
    );
20
  }
21

    
22
  public function testAreaText() {
23
    $view = $this->getBasicView();
24

    
25
    // add a text header.
26
    $string = $this->randomName();
27
    $view->display['default']->handler->override_option('header', array(
28
      'area' => array(
29
        'id' => 'area',
30
        'table' => 'views',
31
        'field' => 'area',
32
        'content' => $string,
33
      ),
34
    ));
35

    
36
    // Execute the view.
37
    $this->executeView($view);
38

    
39
    $view->display_handler->handlers['header']['area']->options['format'] = $this->randomString();
40
    $this->assertEqual(NULL, $view->display_handler->handlers['header']['area']->render(), 'Non existant format should return nothing');
41

    
42
    $view->display_handler->handlers['header']['area']->options['format'] = filter_default_format();
43
    $this->assertEqual(check_markup($string), $view->display_handler->handlers['header']['area']->render(), 'Existant format should return something');
44

    
45
    // Empty results, and it shouldn't be displayed .
46
    $this->assertEqual('', $view->display_handler->handlers['header']['area']->render(TRUE), 'No result should lead to no header');
47
    // Empty results, and it should be displayed.
48
    $view->display_handler->handlers['header']['area']->options['empty'] = TRUE;
49
    $this->assertEqual(check_markup($string), $view->display_handler->handlers['header']['area']->render(TRUE), 'No result, but empty enabled lead to a full header');
50
  }
51

    
52
}