function DateTestCase::testDate in Date 6.2
File
- tests/date.test, line 33
- Date test.
Class
- DateTestCase
- @file
Date test.
Code
function testDate() {
$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();
$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();
$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();
$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();
$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();
$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();
$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();
$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();
$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();
}