You are here

public function DateUITestCase::testFieldUI in Date 7

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

File

tests/date.test, line 26

Class

DateUITestCase

Code

public function testFieldUI() {
  $edit = array();
  $edit['name'] = 'Story';
  $edit['type'] = 'story';
  $this
    ->drupalPost('admin/structure/types/add', $edit, t('Save content type'));
  $this
    ->assertText('The content type Story has been added.', 'Content type added.');

  // Creates select list date field stored as a date with default settings.
  $this
    ->createDateField($type = 'date', $widget = 'date_select');
  $edit = array();
  $this
    ->drupalPost(NULL, $edit, t('Save field settings'));
  $this
    ->dateForm($options = 'select');
  $this
    ->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a date field using the date_select widget.');
  $this
    ->deleteDateField();

  // Creates text date field stored as a date with default settings.
  $this
    ->createDateField($type = 'date', $widget = 'date_text');
  $edit = array();
  $this
    ->drupalPost(NULL, $edit, t('Save field settings'));
  $this
    ->dateForm($options = 'text');
  $this
    ->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a date field using the date_text widget.');
  $this
    ->deleteDateField();

  // Creates popup date field stored as a date with default settings.
  $this
    ->createDateField($type = 'date', $widget = 'date_popup');
  $edit = array();
  $this
    ->drupalPost(NULL, $edit, t('Save field settings'));
  $this
    ->dateForm($options = 'popup');
  $this
    ->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a date field using the date_popup widget.');
  $this
    ->deleteDateField();

  // Creates select list date field stored as a datestamp with default settings.
  $this
    ->createDateField($type = 'datestamp', $widget = 'date_select');
  $edit = array();
  $this
    ->drupalPost(NULL, $edit, t('Save field settings'));
  $this
    ->dateForm($options = 'select');
  $this
    ->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datestamp field using the date_select widget.');
  $this
    ->deleteDateField();

  // Creates text date field stored as a datestamp with default settings.
  $this
    ->createDateField($type = 'datestamp', $widget = 'date_text');
  $edit = array();
  $this
    ->drupalPost(NULL, $edit, t('Save field settings'));
  $this
    ->dateForm($options = 'text');
  $this
    ->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datestamp field using the date_text widget.');
  $this
    ->deleteDateField();

  // Creates popup date field stored as a datestamp with default settings.
  $this
    ->createDateField($type = 'datestamp', $widget = 'date_popup');
  $edit = array();
  $this
    ->drupalPost(NULL, $edit, t('Save field settings'));
  $this
    ->dateForm($options = 'popup');
  $this
    ->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datestamp field using the date_popup widget.');
  $this
    ->deleteDateField();

  // Creates select list date field stored as a datetime with default settings.
  $this
    ->createDateField($type = 'datetime', $widget = 'date_select');
  $edit = array();
  $this
    ->drupalPost(NULL, $edit, t('Save field settings'));
  $this
    ->dateForm($options = 'select');
  $this
    ->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datetime field using the date_select widget.');
  $this
    ->deleteDateField();

  // Creates text date field stored as a datetime with default settings.
  $this
    ->createDateField($type = 'datetime', $widget = 'date_text');
  $edit = array();
  $this
    ->drupalPost(NULL, $edit, t('Save field settings'));
  $this
    ->dateForm($options = 'text');
  $this
    ->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datetime field using the date_text widget.');
  $this
    ->deleteDateField();

  // Creates popup date field stored as a datetime with default settings.
  $this
    ->createDateField($type = 'datetime', $widget = 'date_popup');
  $edit = array();
  $this
    ->drupalPost(NULL, $edit, t('Save field settings'));
  $this
    ->dateForm($options = 'popup');
  $this
    ->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datetime field using the date_popup widget.');
  $this
    ->deleteDateField();
}