You are here

public function DateFieldTest::testField in Date 8

Same name in this branch
  1. 8 lib/Drupal/date/Tests/DateFieldTest.php \Drupal\date\Tests\DateFieldTest::testField()
  2. 8 date_field/lib/Drupal/date_field/Tests/DateFieldTest.php \Drupal\date\Tests\DateFieldTest::testField()

@todo.

File

lib/Drupal/date/Tests/DateFieldTest.php, line 28
Basic functions for Date tests.

Class

DateFieldTest

Namespace

Drupal\date\Tests

Code

public function testField() {

  // Create a date fields with simple values.
  foreach (array(
    'date',
  ) as $field_type) {
    foreach (array(
      'date_select',
      'date_popup',
    ) as $widget_type) {
      $field_name = "field_test_{$widget_type}";
      $label = 'Test';
      $options = array(
        'label' => $label,
        'widget_type' => $widget_type,
        'field_name' => $field_name,
        'field_type' => $field_type,
        'input_format' => 'm/d/Y - H:i',
      );
      $this
        ->createDateField($options);
      $this
        ->dateForm($field_name, $field_type, $widget_type);
      $this
        ->deleteDateField($label);
    }
  }
}