You are here

public function DateRecurRlHelperUnitTest::testExdateTimezone in Recurring Dates Field 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/DateRecurRlHelperUnitTest.php \Drupal\Tests\date_recur\Unit\DateRecurRlHelperUnitTest::testExdateTimezone()
  2. 3.0.x tests/src/Unit/DateRecurRlHelperUnitTest.php \Drupal\Tests\date_recur\Unit\DateRecurRlHelperUnitTest::testExdateTimezone()
  3. 3.1.x tests/src/Unit/DateRecurRlHelperUnitTest.php \Drupal\Tests\date_recur\Unit\DateRecurRlHelperUnitTest::testExdateTimezone()

Tests EXDATE is ignored because of time zone differences.

File

tests/src/Unit/DateRecurRlHelperUnitTest.php, line 173

Class

DateRecurRlHelperUnitTest
Tests Rlanvin implementation of helper.

Namespace

Drupal\Tests\date_recur\Unit

Code

public function testExdateTimezone() {
  $timeZone = new \DateTimeZone('Asia/Singapore');

  // Difference between exdate (UTC) and Singapore is 8 hours.
  // Exdate will be ignored because it never happens at the same time as
  // occurrences.
  $dtStart = new \DateTime('9am 16 June 2014', $timeZone);
  $rrule = 'RRULE:FREQ=DAILY;COUNT=6
EXDATE:20140617T000000Z,20140618T000000Z';
  $instance = $this
    ->createHelper($rrule, $dtStart);
  $occurrences = $instance
    ->getOccurrences();
  $this
    ->assertCount(6, $occurrences);
}