You are here

public function DateRepeatTestCase::testUsaThanksgivingDates in Date 7.3

Same name and namespace in other branches
  1. 7.2 date_repeat/tests/date_repeat.test \DateRepeatTestCase::testUsaThanksgivingDates()

Test USA Thanksgiving rules.

File

date_repeat/tests/date_repeat.test, line 419
Test Date Repeat calculations.

Class

DateRepeatTestCase
Test date repeat functions.

Code

public function testUsaThanksgivingDates() {
  $start = "1997-01-01 09:00:00";
  $end = "2001-02-01 09:00:00";
  $rule = 'RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYDAY=4TH';
  $us_thanksgiving_dates = date_repeat_calc($rule, $start, $end, array());
  $should_be = array(
    0 => '1997-01-01 09:00:00',
    1 => '1997-11-27 09:00:00',
    2 => '1998-11-26 09:00:00',
    3 => '1999-11-25 09:00:00',
    4 => '2000-11-23 09:00:00',
  );
  $this
    ->assertEqual($us_thanksgiving_dates, $should_be, 'Valid USA Thanksgiving result found.');
}