You are here

public function DatePopupFieldTestCase::testField in Date 7.2

Same name and namespace in other branches
  1. 7.3 date_popup/tests/DatePopupFieldTestCase.test \DatePopupFieldTestCase::testField()

Test the field settings.

File

date_popup/tests/DatePopupFieldTestCase.test, line 39
Test the custom field functionality provided by the Date Popup module.

Class

DatePopupFieldTestCase
Test the custom field functionality provided by the Date Popup module.

Code

public function testField() {

  // Test all base field types.
  foreach (array(
    'date',
    'datestamp',
    'datetime',
  ) as $field_type) {

    // Add a Date Popup field to the 'story' content type, but don't remove
    // it.
    $this
      ->checkDateField($field_type, 'date_popup', FALSE);

    // Load the node form.
    $this
      ->drupalGet('node/add/story');
    $this
      ->assertResponse(200);

    // Confirm the date field is present.
    $this
      ->assertFieldByName('field_test_date_popup[und][0][value][date]');
    $this
      ->assertFieldByName('field_test_date_popup[und][0][value][time]');

    // Confirm the JS and CSS files were requested.
    $this
      ->assertRaw('date/date_popup/jquery.timeentry.pack.js');
    $this
      ->assertRaw('date/date_popup/themes/datepicker.1.7.css');
    $this
      ->assertRaw('date/date_popup/themes/jquery.timeentry.css');

    // Now delete the field.
    $this
      ->deleteDateField('Test');
  }
}