public function DateRecurRlHelperUnitTest::testRedundantPartsOmitted 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::testRedundantPartsOmitted()
- 3.0.x tests/src/Unit/DateRecurRlHelperUnitTest.php \Drupal\Tests\date_recur\Unit\DateRecurRlHelperUnitTest::testRedundantPartsOmitted()
- 3.1.x tests/src/Unit/DateRecurRlHelperUnitTest.php \Drupal\Tests\date_recur\Unit\DateRecurRlHelperUnitTest::testRedundantPartsOmitted()
Tests parts that were not passed originally, are not returned.
File
- tests/
src/ Unit/ DateRecurRlHelperUnitTest.php, line 251
Class
- DateRecurRlHelperUnitTest
- Tests Rlanvin implementation of helper.
Namespace
Drupal\Tests\date_recur\UnitCode
public function testRedundantPartsOmitted() {
$dtStart = new \DateTime('9am 16 June 2014');
$rrule = 'FREQ=DAILY;COUNT=10';
$instance = $this
->createHelper($rrule, $dtStart);
$rules = $instance
->getRules();
$this
->assertCount(1, $rules);
$rule = $rules[0];
$parts = $rule
->getParts();
// Rlanvin/rrule will return parts: 'DTSTART', 'FREQ', 'COUNT', 'INTERVAL',
// 'WKST'. However we just need to test completely unrelated parts such as
// BYMONTHDAY etc arn't returned here.
$this
->assertArrayHasKey('DTSTART', $parts);
$this
->assertArrayHasKey('COUNT', $parts);
$this
->assertArrayNotHasKey('BYMONTHDAY', $parts);
}