public function DateRestrictionsStaticMinMaxTestCase::_testIntervalLowerThanMin in Date Restrictions 7
File
- modules/
minmax/ tests/ date_restrictions_minmax.test, line 181 - Tests for date_restrictions_minmax.module.
Class
- DateRestrictionsStaticMinMaxTestCase
- Test "minmax" restrictions, based on static relative/fixed limits.
Code
public function _testIntervalLowerThanMin($context) {
// Set the current time (hour:minute) rather than the default time in this
// date, in order to test date_restrictions's exact validation error.
// This will fail if the seconds pass from :59 to :00 and the minute
// increases while running this test. This has a low probability we can
// live with.
$date = $this
->newDateObject('now', NULL, FALSE);
$start = array(
'year' => $date
->format('Y'),
'month' => $date
->format('n'),
'day' => $date
->format('d'),
);
$this
->postNode($context['field_name'], $context['field_type'], $context['widget_type'], $start);
interval_apply_interval($date, $context['restrictions']['min']['interval']);
$message = t('Dates before @date are not allowed', array(
'@date' => $date
->format($this->date_input_format),
));
$this
->assertText($message, 'Dates before min interval are not allowed (static).');
}