1 views_handler_field_custom.test public ViewsHandlerFieldCustomTest::testFieldCustom()

File

core/modules/views/tests/handlers/views_handler_field_custom.test, line 20
Definition of ViewsHandlerFieldCustomTest.

Class

ViewsHandlerFieldCustomTest
Tests the core views_handler_field_custom handler.

Code

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

  // Alter the text of the field to a random string.
  $random = $this->randomName();
  $view->display['default']->handler->override_option('fields', array(
    'name' => array(
      'id' => 'name',
      'table' => 'views_test',
      'field' => 'name',
      'relationship' => 'none',
      'alter' => array(
        'text' => $random,
      ),
    ),
  ));

  $this->executeView($view);

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