You are here

public function ViewsHandlerFieldUrlTest::testFieldUrl in Views (for Drupal 7) 7.3

File

tests/handlers/views_handler_field_url.test, line 26
Definition of ViewsHandlerFieldUrlTest.

Class

ViewsHandlerFieldUrlTest
Tests the core views_handler_field_url handler.

Code

public function testFieldUrl() {
  $view = $this
    ->getBasicView();
  $view->display['default']->handler
    ->override_option('fields', array(
    'name' => array(
      'id' => 'name',
      'table' => 'views_test',
      'field' => 'name',
      'relationship' => 'none',
      'display_as_link' => FALSE,
    ),
  ));
  $this
    ->executeView($view);
  $this
    ->assertEqual('John', $view->field['name']
    ->advanced_render($view->result[0]));

  // Make the url a link.
  $view
    ->delete();
  $view = $this
    ->getBasicView();
  $view->display['default']->handler
    ->override_option('fields', array(
    'name' => array(
      'id' => 'name',
      'table' => 'views_test',
      'field' => 'name',
      'relationship' => 'none',
    ),
  ));
  $this
    ->executeView($view);
  $this
    ->assertEqual(l('John', 'John'), $view->field['name']
    ->advanced_render($view->result[0]));
}