You are here

public function DateTimezoneTestCase::testFieldWidgetSettings in Date 7.3

Same name and namespace in other branches
  1. 7.2 tests/DateTimezoneTestCase.test \DateTimezoneTestCase::testFieldWidgetSettings()

Test timezone handling validation on the field settings form.

File

tests/DateTimezoneTestCase.test, line 73
Test timezone handling.

Class

DateTimezoneTestCase
Test timezone handling.

Code

public function testFieldWidgetSettings() {
  $label = 'Test';
  $options = array(
    'label' => $label,
    'field_type' => 'date',
    'widget_type' => 'date_select',
    'granularity' => array(
      'year',
      'month',
      'day',
    ),
  );
  $this
    ->createDateField($options);
  $this
    ->drupalGet('admin/structure/types/manage/story/fields/field_' . strtolower($label));
  $this
    ->assertResponse(200);
  $edit = array(
    'field[settings][granularity][hour]' => FALSE,
  );
  $this
    ->drupalPost('admin/structure/types/manage/story/fields/field_' . strtolower($label), $edit, t('Save settings'));
  $this
    ->assertText("Dates without hours granularity must not use any timezone handling.", "Dates without hours granularity required to use timezone handling of 'none.'");
  $this
    ->deleteDateField($label);
}