Project

General

Profile

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

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

1
<?php
2

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

    
8
/**
9
 * Tests the core views_handler_field_custom handler.
10
 */
11
class ViewsHandlerFieldCustomTest extends ViewsSqlTest {
12
  public static function getInfo() {
13
    return array(
14
      'name' => 'Field: Custom',
15
      'description' => 'Test the core views_handler_field_custom handler.',
16
      'group' => 'Views Handlers',
17
    );
18
  }
19

    
20
  function viewsData() {
21
    $data = parent::viewsData();
22
    $data['views_test']['name']['field']['handler'] = 'views_handler_field_custom';
23
    return $data;
24
  }
25

    
26
  public function testFieldCustom() {
27
    $view = $this->getBasicView();
28

    
29
    // Alter the text of the field to a random string.
30
    $random = $this->randomName();
31
    $view->display['default']->handler->override_option('fields', array(
32
      'name' => array(
33
        'id' => 'name',
34
        'table' => 'views_test',
35
        'field' => 'name',
36
        'relationship' => 'none',
37
        'alter' => array(
38
          'text' => $random,
39
        ),
40
      ),
41
    ));
42

    
43
    $this->executeView($view);
44

    
45
    $this->assertEqual($random, $view->style_plugin->get_field(0, 'name'));
46
  }
47

    
48
}