You are here

public function DateRestrictionsStaticMinMaxTestCase::_testIntervalGreaterThanMax in Date Restrictions 7

File

modules/minmax/tests/date_restrictions_minmax.test, line 216
Tests for date_restrictions_minmax.module.

Class

DateRestrictionsStaticMinMaxTestCase
Test "minmax" restrictions, based on static relative/fixed limits.

Code

public function _testIntervalGreaterThanMax($context) {
  $now = $this
    ->newDateObject('now', NULL, FALSE);
  $date = clone $now;
  $date
    ->modify('+ 2 days');
  $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);
  $date = clone $now;
  interval_apply_interval($date, $context['restrictions']['max']['interval']);
  $message = t('Dates after @date are not allowed', array(
    '@date' => $date
      ->format($this->date_input_format),
  ));
  $this
    ->assertText($message, 'Dates after max interval are not allowed (static).');
}