You are here

public function DateRecurRruleUnitTest::testGetExcluded in Recurring Dates Field 3.1.x

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

Tests list.

@covers ::getExcluded

File

tests/src/Unit/DateRecurRruleUnitTest.php, line 139

Class

DateRecurRruleUnitTest
Date recur tests.

Namespace

Drupal\Tests\date_recur\Unit

Code

public function testGetExcluded() {
  $tz = new \DateTimeZone('Asia/Singapore');
  $dtStart = new \DateTime('9am 4 September 2018', $tz);
  $string = 'RRULE:FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR;COUNT=3
EXDATE:20180906T010000Z';
  $helper = $this
    ->newRule($string, $dtStart);
  $excluded = $helper
    ->getExcluded();
  $this
    ->assertCount(1, $excluded);
  $expectedDate = new \DateTime('9am 6 September 2018', $tz);
  $this
    ->assertEquals($expectedDate, $excluded[0]);
}