1 date.test DateUITestCase::dateForm($options)

File

core/modules/date/tests/date.test, line 51
Test date UI.

Class

DateUITestCase

Code

function dateForm($options) {
  // Tests that date field functions properly.
  $edit = array();
  $edit['title'] = $this->randomName(8);
  $edit['body[und][0][value]'] = $this->randomName(16);
  $current_year = date('Y');

  if ($options == 'date_select') {
    $edit['field_test[und][0][value][year]'] = $current_year;
    $edit['field_test[und][0][value][month]'] = '10';
    $edit['field_test[und][0][value][day]'] = '7';
    $edit['field_test[und][0][value][hour]'] = '10';
    $edit['field_test[und][0][value][minute]'] = '30';
    $edit['field_test[und][0][value][ampm]'] = 'am';
  }
  elseif ($options == 'date_text') {
    $edit['field_test[und][0][value][date]'] = format_string('10/07/!year - 10:30', array('!year' => $current_year));
  }
  elseif ($options == 'date_popup') {
    $edit['field_test[und][0][value][date]'] = format_string('10/07/!year', array('!year' => $current_year));
    $edit['field_test[und][0][value][time]'] = '10:30';
  }
  $this->backdropPost('node/add/story', $edit, t('Save'));
  $this->assertText($edit['body[und][0][value]'], 'Test node has been created');
}