You are here

protected function DateValidationTestCase::checkDateField in Date 7.2

Same name and namespace in other branches
  1. 7.3 tests/DateValidationTestCase.test \DateValidationTestCase::checkDateField()

Run some tests against a specific field type/widget combination.

Parameters

string $field_type: The field type to use.

string $widget_type: The widget type to use.

bool $delete_when_done: Whether to delete the field when it's finished; defaults to TRUE.

Overrides DateFieldTestBase::checkDateField

2 calls to DateValidationTestCase::checkDateField()
DatePopupValidationTestCase::testValidation in date_popup/tests/DatePopupValidationTestCase.test
Validate the Date Popup fields.
DateValidationTestCase::testValidation in tests/DateValidationTestCase.test
Create text date field.

File

tests/DateValidationTestCase.test, line 42
Validate date field values.

Class

DateValidationTestCase
Validate date field values.

Code

protected function checkDateField($field_type, $widget_type, $delete_when_done = TRUE) {
  $field_name = 'field_test';
  $label = 'Test';
  $options = array(
    'label' => $label,
    'field_name' => $field_name,
    'field_type' => $field_type,
    'widget_type' => $widget_type,
    'input_format' => 'm/d/Y - H:i',
  );
  $this
    ->createDateField($options);

  // Malformed date test won't work on date_select, which won't allow
  // invalid input.
  if ($widget_type !== 'date_select') {
    $this
      ->malFormedDate($field_name, $field_type, $widget_type);
  }
  $this
    ->wrongGranularity($field_name, $field_type, $widget_type);
  if ($delete_when_done) {
    $this
      ->deleteDateField($label);
  }
}