public function DateUiTestCase::dateForm in Date 7.3
Same name and namespace in other branches
- 7 tests/date.test \DateUITestCase::dateForm()
- 7.2 tests/DateUiTestCase.test \DateUiTestCase::dateForm()
Tests that date field functions properly.
Overrides DateFieldTestBase::dateForm
1 call to DateUiTestCase::dateForm()
- DateUiTestCase::testFieldUi in tests/
DateUiTestCase.test - Test field UI.
File
- tests/
DateUiTestCase.test, line 61 - Test date UI.
Class
- DateUiTestCase
- Date UI related tests.
Code
public function dateForm($field_name, $field_type, $widget_type, $todate = TRUE) {
// Tests that date field functions properly.
$edit = array();
$edit['title'] = self::randomName(8);
$edit['body[und][0][value]'] = self::randomName(16);
$current_year = date('Y');
if ($widget_type === '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';
}
elseif ($widget_type === 'date_text') {
$edit['field_test[und][0][value][date]'] = format_string('10/07/!year - 10:30', array(
'!year' => $current_year,
));
}
elseif ($widget_type === '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
->drupalPost('node/add/story', $edit, t('Save'));
$this
->assertText($edit['body[und][0][value]'], 'Test node has been created');
}