You are here

public function DateRecurRlHelperUnitTest::testInvalidLimit in Recurring Dates Field 3.1.x

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

Tests invalid argument for limit.

File

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

Class

DateRecurRlHelperUnitTest
Tests Rlanvin implementation of helper.

Namespace

Drupal\Tests\date_recur\Unit

Code

public function testInvalidLimit() {
  $helper = $this
    ->createHelper('FREQ=DAILY;COUNT=10', new \DateTime('2am 14 April 2014'), new \DateTime('4am 14 April 2014'));
  $this
    ->expectException(\InvalidArgumentException::class);
  $this
    ->expectExceptionMessage('Invalid count limit.');
  $helper
    ->getOccurrences(new \DateTime('1am 14 April 2014'), new \DateTime('3am 14 April 2014'), -1);
}