function DateTestCase::testDate in Date 6.2
File
- tests/
date.test, line 33 - Date test.
Class
- DateTestCase
- @file Date test.
Code
function testDate() {
// Creates select list date field stored as a date with default settings.
$current_year = date('Y');
$this
->createDateField($type = 'date', $widget = 'date_select');
$edit = array();
$this
->drupalPost(NULL, $edit, t('Save field settings'));
$this
->dateForm($options = 'select');
$this
->assertText(strtr('10/07/!year - 10:30', array(
'!year' => $current_year,
)), 'Found the correct date for a date field using the date_select widget.');
$this
->deleteDateField();
// Creates text date field stored as a date with default settings.
$this
->createDateField($type = 'date', $widget = 'date_text');
$edit = array();
$this
->drupalPost(NULL, $edit, t('Save field settings'));
$this
->dateForm($options = 'text');
$this
->assertText(strtr('10/07/!year - 10:30', array(
'!year' => $current_year,
)), 'Found the correct date for a date field using the date_text widget.');
$this
->deleteDateField();
// Creates popup date field stored as a date with default settings.
$this
->createDateField($type = 'date', $widget = 'date_popup');
$edit = array(
'input_format' => 'm/d/Y - H:i',
);
$this
->drupalPost(NULL, $edit, t('Save field settings'));
$this
->dateForm($options = 'popup');
$this
->assertText(strtr('10/07/!year - 10:30', array(
'!year' => $current_year,
)), 'Found the correct date for a date field using the date_popup widget.');
$this
->deleteDateField();
// Creates select list date field stored as a datestamp with default settings.
$this
->createDateField($type = 'datestamp', $widget = 'date_select');
$edit = array();
$this
->drupalPost(NULL, $edit, t('Save field settings'));
$this
->dateForm($options = 'select');
$this
->assertText(strtr('10/07/!year - 10:30', array(
'!year' => $current_year,
)), 'Found the correct date for a datestamp field using the date_select widget.');
$this
->deleteDateField();
// Creates text date field stored as a datestamp with default settings.
$this
->createDateField($type = 'datestamp', $widget = 'date_text');
$edit = array();
$this
->drupalPost(NULL, $edit, t('Save field settings'));
$this
->dateForm($options = 'text');
$this
->assertText(strtr('10/07/!year - 10:30', array(
'!year' => $current_year,
)), 'Found the correct date for a datestamp field using the date_text widget.');
$this
->deleteDateField();
// Creates popup date field stored as a datestamp with default settings.
$this
->createDateField($type = 'datestamp', $widget = 'date_popup');
$edit = array(
'input_format' => 'm/d/Y - H:i',
);
$this
->drupalPost(NULL, $edit, t('Save field settings'));
$this
->dateForm($options = 'popup');
$this
->assertText(strtr('10/07/!year - 10:30', array(
'!year' => $current_year,
)), 'Found the correct date for a datestamp field using the date_popup widget.');
$this
->deleteDateField();
// Creates select list date field stored as a datetime with default settings.
$this
->createDateField($type = 'datetime', $widget = 'date_select');
$edit = array();
$this
->drupalPost(NULL, $edit, t('Save field settings'));
$this
->dateForm($options = 'select');
$this
->assertText(strtr('10/07/!year - 10:30', array(
'!year' => $current_year,
)), 'Found the correct date for a datetime field using the date_select widget.');
$this
->deleteDateField();
// Creates text date field stored as a datetime with default settings.
$this
->createDateField($type = 'datetime', $widget = 'date_text');
$edit = array();
$this
->drupalPost(NULL, $edit, t('Save field settings'));
$this
->dateForm($options = 'text');
$this
->assertText(strtr('10/07/!year - 10:30', array(
'!year' => $current_year,
)), 'Found the correct date for a datetime field using the date_text widget.');
$this
->deleteDateField();
// Creates popup date field stored as a datetime with default settings.
$this
->createDateField($type = 'datetime', $widget = 'date_popup');
$edit = array(
'input_format' => 'm/d/Y - H:i',
);
$this
->drupalPost(NULL, $edit, t('Save field settings'));
$this
->dateForm($options = 'popup');
$this
->assertText(strtr('10/07/!year - 10:30', array(
'!year' => $current_year,
)), 'Found the correct date for a datetime field using the date_popup widget.');
$this
->deleteDateField();
}