You are here

public function DateRepeatFormTestCase::testDateRepeatForm in Date 7.2

Same name and namespace in other branches
  1. 7.3 date_repeat/tests/date_repeat_form.test \DateRepeatFormTestCase::testDateRepeatForm()

Test the Date Repeat form.

File

date_repeat/tests/date_repeat_form.test, line 57
Test Date Repeat form.

Class

DateRepeatFormTestCase
Test Date Repeat form.

Code

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

  // Testing options.
  $widget_options = array(
    'date_select' => 'select',
    'date_text' => 'text',
    'date_popup' => 'popup',
  );
  foreach ($widget_options as $widget => $options) {

    // Daily tests
    // Creates date field stored as a datetime.
    $this
      ->createDateField($type = 'datetime', $widget, $display_all_day);
    $form_edit = $this
      ->dateForm($options, 'daily_1');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'daily_2');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'daily_3');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'daily_4');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'daily_1', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'daily_2', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'daily_3', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'daily_4', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'daily_1', FALSE, 'exclude');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'daily_1', FALSE, 'include');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'daily_1', FALSE, 'exclude_include');
    $this
      ->verifyDateForm($form_edit);

    // Weekly tests.
    $form_edit = $this
      ->dateForm($options, 'weekly_1');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'weekly_2');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'weekly_3');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'weekly_4');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'weekly_1', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'weekly_2', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'weekly_3', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'weekly_4', TRUE);
    $this
      ->verifyDateForm($form_edit);

    // Monthly tests.
    $form_edit = $this
      ->dateForm($options, 'monthly_1');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'monthly_2');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'monthly_3');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'monthly_4');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'monthly_5');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'monthly_6');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'monthly_1', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'monthly_2', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'monthly_3', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'monthly_4', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'monthly_5', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'monthly_6', TRUE);
    $this
      ->verifyDateForm($form_edit);

    // Yearly tests.
    $form_edit = $this
      ->dateForm($options, 'yearly_1');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'yearly_2');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'yearly_3');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'yearly_4');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'yearly_5');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'yearly_6');
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'yearly_1', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'yearly_2', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'yearly_3', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'yearly_4', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'yearly_5', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $form_edit = $this
      ->dateForm($options, 'yearly_6', TRUE);
    $this
      ->verifyDateForm($form_edit);
    $this
      ->deleteDateField();
  }
}