You are here

public function DateToolsTestCase::dateForm in Date 7.2

Same name and namespace in other branches
  1. 7.3 date_tools/tests/DateToolsTestCase.test \DateToolsTestCase::dateForm()
  2. 7 date_tools/tests/date_tools.test \DateToolsTestCase::dateForm()

Tests that date field functions properly.

1 call to DateToolsTestCase::dateForm()
DateToolsTestCase::testTools in date_tools/tests/DateToolsTestCase.test
Creates a date field using the Date Wizard.

File

date_tools/tests/DateToolsTestCase.test, line 75
Tests for Date Tools.

Class

DateToolsTestCase
Tests for Date Tools.

Code

public function dateForm($options) {
  $edit = array();
  $edit['title'] = $this
    ->randomName(8);
  $edit['body[und][0][value]'] = $this
    ->randomName(16);
  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['body[und][0][value]'], 'Test node has been created');
}