You are here

public function DateRestrictionsHostEntityMinMaxTestCase::_testDateGreaterThanMax in Date Restrictions 7

File

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

Class

DateRestrictionsHostEntityMinMaxTestCase
Tests for host_entity based relative/fixed minmax restrictions.

Code

public function _testDateGreaterThanMax($context) {
  $year = date('Y');
  $start = array(
    'year' => $year,
    'month' => 4,
    'day' => 12,
  );

  // Prepare the value for the host entity date field.
  $date = $this
    ->newDateObject("{$year}-04-01");
  $edit = $this
    ->setHostEntityDate($date);
  $this
    ->postNode($context['field_name'], $context['field_type'], $context['widget_type'], $start, NULL, $edit);
  $message = t('Dates after @date are not allowed', array(
    '@date' => $date
      ->format($this->date_input_format),
  ));
  $this
    ->assertText($message, 'Dates after max date are not allowed (host entity).');
}