public function MathfieldWidgetTestCase::testMathfieldTextWidget in Math Field 7        
                          
                  
                        
File
 
   - ./mathfield.test, line 162
 
  - Tests for mathfield.module.
 
  Class
  
  - MathfieldWidgetTestCase 
 
  - Test math field widgets.
 
Code
public function testMathfieldTextWidget() {
  $this
    ->createField('field_a', 'A', 'number_integer');
  $this
    ->createField('field_b', 'B', 'number_integer');
  
  $a = $this
    ->randInteger();
  $b = $this
    ->randInteger();
  $result = number_format($a + $b, 2, '.', '');
  $this
    ->createMathExpressionField('field_a_b', 'A + B', '[field_a] + [field_b]');
  
  $this
    ->drupalGet('node/add/math');
  $this
    ->assertFieldByXPath('//input[@type="text" and @name="field_a_b[und][0][value]"]', NULL, 'Math expression text field widget is displayed on the node add form.');
  
  $edit = array();
  $edit['title'] = $this
    ->randomName(8);
  $edit["field_a[und][0][value]"] = $a;
  $edit["field_b[und][0][value]"] = $b;
  $this
    ->drupalPost('node/add/math', $edit, t('Save'));
  $this
    ->assertText($result, 'Evaluated the math expression text field widget.');
  
  $this
    ->clickLink(t('Edit'));
  $this
    ->assertFieldByXPath('//input[@type="text" and @name="field_a_b[und][0][value]"]', $result, 'Math expression text field widget is displayed on the edit form.');
}