5 * Definition of ViewsHandlerFieldMath.
9 * Tests the core views_handler_field_math handler.
11 class ViewsHandlerFieldMath extends ViewsSqlTest {
12 public static function getInfo() {
14 'name' => 'Field: Math',
15 'description' => 'Test the core views_handler_field_math handler.',
16 'group' => 'Views Handlers',
20 function viewsData() {
21 $data = parent::viewsData();
25 public function testFieldCustom() {
26 $view = $this->getBasicView();
28 // Alter the text of the field to a random string.
29 $rand1 = rand(0, 100);
30 $rand2 = rand(0, 100);
31 $view->display['default']->handler->override_option('fields', array(
32 'expression' => array(
35 'field' => 'expression',
36 'relationship' => 'none',
37 'expression' => $rand1 . ' + ' . $rand2,
41 $this->executeView($view);
43 $this->assertEqual($rand1 + $rand2, $view->style_plugin->get_field(0, 'expression'));