You are here

public function DateRecurRlInterpretationUnitTest::testHourly in Recurring Dates Field 3.0.x

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

Tests hourly interpretation.

File

tests/src/Unit/DateRecurRlInterpretationUnitTest.php, line 111

Class

DateRecurRlInterpretationUnitTest
Tests Rlanvin implementation of interpreter.

Namespace

Drupal\Tests\date_recur\Unit

Code

public function testHourly() {
  $parts = [
    'FREQ' => 'HOURLY',
    'DTSTART' => new \DateTime('4am 15 July 2012', new \DateTimeZone('Pacific/Honolulu')),
    'BYHOUR' => '4,7',
  ];
  $rules[] = new RlDateRecurRule($parts);
  $configuration = [
    'date_format' => $this
      ->randomMachineName(),
  ];
  $interpreter = RlInterpreter::create($this->testContainer, $configuration, '', []);
  $interpretation = $interpreter
    ->interpret($rules, 'en');
  $this
    ->assertEquals('hourly at 4h and 7h, starting from Mon, 16 Jul 2012 00:00:00 +1000, forever', $interpretation);
}