You are here

public function DateUITest::testFieldUI in Date 8

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

@todo.

File

lib/Drupal/date/Tests/DateUITest.php, line 48
Test date UI.

Class

DateUITest

Namespace

Drupal\date\Tests

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 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 popup 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();

  // Test timezone handling validation on the field settings form.
  $this
    ->createDateField($type = 'date', $widget = 'date_select');
  $edit = array(
    'field[settings][granularity][hour]' => FALSE,
  );
  $this
    ->drupalPost(NULL, $edit, t('Save field settings'));
  $this
    ->assertText("Dates without hours granularity must not use any timezone handling.", "Dates without hours granularity required to use timezone handling of 'none.'");
  $this
    ->deleteDateField();
}