You are here

public function DateUiTestCase::testFieldUi in Date 7.2

Same name and namespace in other branches
  1. 7.3 tests/DateUiTestCase.test \DateUiTestCase::testFieldUi()
  2. 7 tests/date.test \DateUITestCase::testFieldUI()

Test field UI.

File

tests/DateUiTestCase.test, line 36
Test date UI.

Class

DateUiTestCase
Date UI related tests.

Code

public function testFieldUi() {
  $label = 'Test';
  $current_year = date('Y');

  // Test widgets with default settings using every widget and field type.
  foreach (array(
    'date',
    'datestamp',
    'datetime',
  ) as $field_type) {

    // @todo Add back 'date_popup'.
    foreach (array(
      'date_select',
      'date_text',
    ) as $widget_type) {
      $this
        ->createDateField(array(
        'label' => $label,
        'field_type' => $field_type,
        'widget_type' => $widget_type,
      ));
      $this
        ->dateForm('blah', 'blah', $widget_type);
      $this
        ->assertText(format_string('10/07/!year - 10:30', array(
        '!year' => $current_year,
      )), 'Found the correct date for a date field using the ' . $widget_type . ' widget.');
      $this
        ->deleteDateField($label);
    }
  }
}