You are here

function SelectOrOtherNumberTestCase::testOtherSelected in Select (or other) 7.3

Same name and namespace in other branches
  1. 7.2 tests/select_or_other_number.test \SelectOrOtherNumberTestCase::testOtherSelected()

File

tests/select_or_other_number.test, line 66

Class

SelectOrOtherNumberTestCase
Tests the select or other text field based functionality

Code

function testOtherSelected() {
  foreach ($this->fields as $field_name => $field) {
    $other = rand(50, 100);
    $this
      ->setFieldValue($field_name, 'select_or_other', $other);

    // Add the </div> because assertRaw fails for integer values.
    if (in_array($field['field_settings']['type'], array(
      'number_float',
      'number_decimal',
    ))) {
      $this
        ->assertRaw("{$other}.00</div>");
    }
    else {
      $this
        ->assertRaw("{$other}</div>");
    }
    $this
      ->assertNoRaw('select_or_other');
  }
}