public function DateRecurRlHelperUnitTest::testExdateMultiple in Recurring Dates Field 3.x
Same name and namespace in other branches
- 8.2 tests/src/Unit/DateRecurRlHelperUnitTest.php \Drupal\Tests\date_recur\Unit\DateRecurRlHelperUnitTest::testExdateMultiple()
- 3.0.x tests/src/Unit/DateRecurRlHelperUnitTest.php \Drupal\Tests\date_recur\Unit\DateRecurRlHelperUnitTest::testExdateMultiple()
- 3.1.x tests/src/Unit/DateRecurRlHelperUnitTest.php \Drupal\Tests\date_recur\Unit\DateRecurRlHelperUnitTest::testExdateMultiple()
Tests multiple EXDATE values.
File
- tests/
src/ Unit/ DateRecurRlHelperUnitTest.php, line 147
Class
- DateRecurRlHelperUnitTest
- Tests Rlanvin implementation of helper.
Namespace
Drupal\Tests\date_recur\UnitCode
public function testExdateMultiple() {
$timeZone = new \DateTimeZone('Asia/Singapore');
// Difference between exdate (UTC) and Singapore is 8 hours.
$dtStart = new \DateTime('10am 16 June 2014', $timeZone);
$rrule = 'RRULE:FREQ=DAILY;COUNT=6
EXDATE:20140617T020000Z,20140619T020000Z';
$instance = $this
->createHelper($rrule, $dtStart);
$occurrences = $instance
->getOccurrences();
$this
->assertCount(4, $occurrences);
// Occurrence time zones are same as start date.
$this
->assertEquals('Mon, 16 Jun 2014 10:00:00 +0800', $occurrences[0]
->getStart()
->format('r'));
$this
->assertEquals('Wed, 18 Jun 2014 10:00:00 +0800', $occurrences[1]
->getStart()
->format('r'));
$this
->assertEquals('Fri, 20 Jun 2014 10:00:00 +0800', $occurrences[2]
->getStart()
->format('r'));
$this
->assertEquals('Sat, 21 Jun 2014 10:00:00 +0800', $occurrences[3]
->getStart()
->format('r'));
// Exdate time zones are same as original, not same as start date.
$exDates = $instance
->getRlRuleset()
->getExDates();
$this
->assertCount(2, $exDates);
$this
->assertEquals('Tue, 17 Jun 2014 02:00:00 +0000', $exDates[0]
->format('r'));
$this
->assertEquals('Thu, 19 Jun 2014 02:00:00 +0000', $exDates[1]
->format('r'));
}