You are here

function DateToolsTest::dateForm in Date 8

Tests that date field functions properly.

1 call to DateToolsTest::dateForm()
DateToolsTest::testTools in date_tools/lib/Drupal/date_tools/Tests/DateToolsTest.php
Creates a date field using the Date Wizard.

File

date_tools/lib/Drupal/date_tools/Tests/DateToolsTest.php, line 60
Tests for Date Tools.

Class

DateToolsTest

Namespace

Drupal\date_tools\Tests

Code

function dateForm($options) {
  $edit = array();
  $edit['title'] = $this
    ->randomName(8);
  if ($options == 'select') {
    $edit['field_test[und][0][value][year]'] = '2010';
    $edit['field_test[und][0][value][month]'] = '10';
    $edit['field_test[und][0][value][day]'] = '7';
    $edit['field_test[und][0][value][hour]'] = '10';
    $edit['field_test[und][0][value][minute]'] = '30';
  }
  elseif ($options == 'text') {
    $edit['field_test[und][0][value][date]'] = '10/07/2010 - 10:30';
  }
  elseif ($options == 'popup') {
    $edit['field_test[und][0][value][date]'] = '10/07/2010';
    $edit['field_test[und][0][value][time]'] = '10:30';
  }
  $this
    ->drupalPost('node/add/story', $edit, t('Save'));
  $this
    ->assertText($edit['title'] . ' has been created.', 'Test node has been created');
}