You are here

public function viewsHandlerFieldUserNameTest::testOptions in Views (for Drupal 7) 7.3

Tests that deselecting 'link_to_user' and 'format_username' works.

File

tests/user/views_handler_field_user_name.test, line 58
Definition of viewsHandlerFieldUserNameTest.

Class

viewsHandlerFieldUserNameTest
Tests the field username handler.

Code

public function testOptions() {
  $view = $this
    ->view_raw_user_name();
  $view
    ->init_display();
  $this
    ->executeView($view);
  $view->row_index = 0;
  $username = $view->result[0]->users_name = 'test';
  $view->result[0]->uid = 1;
  $render = $view->field['name']
    ->advanced_render($view->result[0]);
  $this
    ->assertTrue(strpos($render, $username) !== FALSE, 'If link to user is checked the username should be part of the output.');
}