Project

General

Profile

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

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

1
<?php
2

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

    
8
/**
9
 * Tests the core views_handler_field_url handler.
10
 */
11
class ViewsHandlerFieldUrlTest extends ViewsSqlTest {
12
  public static function getInfo() {
13
    return array(
14
      'name' => 'Field: Url',
15
      'description' => 'Test the core views_handler_field_url 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_url';
23
    return $data;
24
  }
25

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

    
29
    $view->display['default']->handler->override_option('fields', array(
30
      'name' => array(
31
        'id' => 'name',
32
        'table' => 'views_test',
33
        'field' => 'name',
34
        'relationship' => 'none',
35
        'display_as_link' => FALSE,
36
      ),
37
    ));
38

    
39
    $this->executeView($view);
40

    
41
    $this->assertEqual('John', $view->field['name']->advanced_render($view->result[0]));
42

    
43
    // Make the url a link.
44
    $view->delete();
45
    $view = $this->getBasicView();
46

    
47
    $view->display['default']->handler->override_option('fields', array(
48
      'name' => array(
49
        'id' => 'name',
50
        'table' => 'views_test',
51
        'field' => 'name',
52
        'relationship' => 'none',
53
      ),
54
    ));
55

    
56
    $this->executeView($view);
57

    
58
    $this->assertEqual(l('John', 'John'), $view->field['name']->advanced_render($view->result[0]));
59
  }
60

    
61
}