You are here

public function DateRecurModularOscarTest::providerTestWidget in Recurring Date Field Modular Widgets 8

Same name and namespace in other branches
  1. 3.x tests/src/Functional/DateRecurModularOscarTest.php \Drupal\Tests\date_recur_modular\Functional\DateRecurModularOscarTest::providerTestWidget()
  2. 2.x tests/src/Functional/DateRecurModularOscarTest.php \Drupal\Tests\date_recur_modular\Functional\DateRecurModularOscarTest::providerTestWidget()

Data provider for testWidget()

Return value

array Data for testing.

File

tests/src/Functional/DateRecurModularOscarTest.php, line 88

Class

DateRecurModularOscarTest
Tests Oscar Widget.

Namespace

Drupal\Tests\date_recur_modular\Functional

Code

public function providerTestWidget() : array {
  $data = [];
  $data['once'] = [
    [
      'dr[0][mode]' => 'once',
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => NULL,
      'infinite' => FALSE,
      'timezone' => 'Asia/Singapore',
    ],
  ];
  $data['multi'] = [
    [
      'dr[0][mode]' => 'multiday',
      'dr[0][daily_count]' => 3,
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '5:00:00pm',
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=DAILY;INTERVAL=1;COUNT=3',
      'infinite' => FALSE,
      'timezone' => 'Asia/Singapore',
    ],
  ];
  $data['weekly'] = [
    [
      'dr[0][mode]' => 'weekly',
      'dr[0][weekdays][MO]' => TRUE,
      'dr[0][weekdays][WE]' => TRUE,
      'dr[0][weekdays][FR]' => TRUE,
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,FR',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];
  $data['fortnightly'] = [
    [
      'dr[0][mode]' => 'fortnightly',
      'dr[0][weekdays][MO]' => TRUE,
      'dr[0][weekdays][WE]' => TRUE,
      'dr[0][weekdays][FR]' => TRUE,
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,WE,FR',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];
  $data['allday'] = [
    [
      'dr[0][mode]' => 'once',
      'dr[0][day_start]' => '04/14/2015',
    ],
    [
      'value' => '2015-04-13T16:00:00',
      'end_value' => '2015-04-14T15:59:59',
      'rrule' => NULL,
      'infinite' => FALSE,
      'timezone' => 'Asia/Singapore',
    ],
    TRUE,
  ];

  // First Friday of the month.
  $data['monthly 1 ordinal 1 weekday'] = [
    [
      'dr[0][mode]' => 'monthly',
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
      // Set weekday first, ordinals will appear after it.
      'dr[0][weekdays][FR]' => TRUE,
      'dr[0][ordinals][1]' => TRUE,
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=MONTHLY;INTERVAL=1;BYDAY=FR;BYSETPOS=1',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];

  // First Thursday and Friday of the month.
  $data['monthly 1 ordinal 2 weekday'] = [
    [
      'dr[0][mode]' => 'monthly',
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
      'dr[0][weekdays][TH]' => TRUE,
      'dr[0][weekdays][FR]' => TRUE,
      'dr[0][ordinals][1]' => TRUE,
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TH,FR;BYSETPOS=1,2',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];

  // First and second Friday of the month.
  $data['monthly 1,2 ordinal 1 weekday'] = [
    [
      'dr[0][mode]' => 'monthly',
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
      'dr[0][weekdays][FR]' => TRUE,
      'dr[0][ordinals][1]' => TRUE,
      'dr[0][ordinals][2]' => TRUE,
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=MONTHLY;INTERVAL=1;BYDAY=FR;BYSETPOS=1,2',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];

  // First and second Thursday and Friday of the month.
  $data['monthly 1,2 ordinal 2 weekday'] = [
    [
      'dr[0][mode]' => 'monthly',
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
      'dr[0][weekdays][TH]' => TRUE,
      'dr[0][weekdays][FR]' => TRUE,
      'dr[0][ordinals][1]' => TRUE,
      'dr[0][ordinals][2]' => TRUE,
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TH,FR;BYSETPOS=1,2,3,4',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];

  // Last Thursday of the month.
  $data['monthly -1 ordinal 1 weekday'] = [
    [
      'dr[0][mode]' => 'monthly',
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
      'dr[0][weekdays][TH]' => TRUE,
      'dr[0][ordinals][-1]' => TRUE,
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TH;BYSETPOS=-1',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];

  // Last Thursday and Friday of the month.
  $data['monthly -1 ordinal 2 weekday'] = [
    [
      'dr[0][mode]' => 'monthly',
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
      'dr[0][weekdays][TH]' => TRUE,
      'dr[0][weekdays][FR]' => TRUE,
      'dr[0][ordinals][-1]' => TRUE,
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TH,FR;BYSETPOS=-2,-1',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];

  // Second to last Thursday of the month.
  $data['monthly -2 ordinal 1 weekday'] = [
    [
      'dr[0][mode]' => 'monthly',
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
      'dr[0][weekdays][TH]' => TRUE,
      'dr[0][ordinals][-2]' => TRUE,
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TH;BYSETPOS=-2',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];

  // Second to last Thursday and Friday of the month.
  $data['monthly -4,-3 ordinal 2 weekday'] = [
    [
      'dr[0][mode]' => 'monthly',
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
      'dr[0][weekdays][TH]' => TRUE,
      'dr[0][weekdays][FR]' => TRUE,
      'dr[0][ordinals][-2]' => TRUE,
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TH,FR;BYSETPOS=-4,-3',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];

  // Last and Second to last Thursday and Friday of the month.
  $data['monthly -4,-3-2,-1 ordinal 2 weekday'] = [
    [
      'dr[0][mode]' => 'monthly',
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
      'dr[0][weekdays][TH]' => TRUE,
      'dr[0][weekdays][FR]' => TRUE,
      'dr[0][ordinals][-1]' => TRUE,
      'dr[0][ordinals][-2]' => TRUE,
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TH,FR;BYSETPOS=-4,-3,-2,-1',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];

  // Combination second and second to last Thursday and Friday of the month.
  $data['monthly -4,-3,3,4 ordinal 2 weekday'] = [
    [
      'dr[0][mode]' => 'monthly',
      'dr[0][day_start]' => '04/14/2015',
      'dr[0][times][time_start]' => '09:00:00am',
      'dr[0][times][time_end]' => '05:00:00pm',
      'dr[0][weekdays][TH]' => TRUE,
      'dr[0][weekdays][FR]' => TRUE,
      'dr[0][ordinals][2]' => TRUE,
      'dr[0][ordinals][-2]' => TRUE,
    ],
    [
      'value' => '2015-04-14T01:00:00',
      'end_value' => '2015-04-14T09:00:00',
      'rrule' => 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TH,FR;BYSETPOS=-4,-3,3,4',
      'infinite' => TRUE,
      'timezone' => 'Asia/Singapore',
    ],
  ];
  return $data;
}