You are here

public function ViewsHandlerFieldMath::testFieldCustom in Views (for Drupal 7) 7.3

File

tests/handlers/views_handler_field_math.test, line 25
Definition of ViewsHandlerFieldMath.

Class

ViewsHandlerFieldMath
Tests the core views_handler_field_math handler.

Code

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

  // Alter the text of the field to a random string.
  $rand1 = rand(0, 100);
  $rand2 = rand(0, 100);
  $view->display['default']->handler
    ->override_option('fields', array(
    'expression' => array(
      'id' => 'expression',
      'table' => 'views',
      'field' => 'expression',
      'relationship' => 'none',
      'expression' => $rand1 . ' + ' . $rand2,
    ),
  ));
  $this
    ->executeView($view);
  $this
    ->assertEqual($rand1 + $rand2, $view->style_plugin
    ->get_field(0, 'expression'));
}