public function FieldCustomTest::testFieldCustom

File

drupal/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCustomTest.php, line 38
Definition of Drupal\views\Tests\Handler\FieldCustomTest.

Class

FieldCustomTest
Tests the core Drupal\views\Plugin\views\field\Custom handler.

Namespace

Drupal\views\Tests\Handler

Code

public function testFieldCustom() {
  $view = views_get_view('test_view');
  $view
    ->setDisplay();

  // Alter the text of the field to a random string.
  $random = $this
    ->randomName();
  $view->displayHandlers['default']
    ->overrideOption('fields', array(
    'name' => array(
      'id' => 'name',
      'table' => 'views_test_data',
      'field' => 'name',
      'relationship' => 'none',
      'alter' => array(
        'text' => $random,
      ),
    ),
  ));
  $this
    ->executeView($view);
  $this
    ->assertEqual($random, $view->style_plugin
    ->get_field(0, 'name'));
}