public function FixedReferenceDateIntervalTest::testFixedIntervalPlugin in Recurring Time Period 8
Tests the fixed interval plugin.
@dataProvider testFixedIntervalPluginProvider
File
- tests/
src/ Kernel/ FixedReferenceDateIntervalTest.php, line 19
Class
- FixedReferenceDateIntervalTest
- Tests the fixed interval plugin.
Namespace
Drupal\Tests\recurring_period\KernelCode
public function testFixedIntervalPlugin($timezone_name, $reference_date, $interval, $start_date, $expected_next, $expected_start) {
$timezone = new \DateTimeZone($timezone_name);
/** @var RecurringPeriodInterface $plugin */
$plugin = $this->recurringPeriodManager
->createInstance('fixed_reference_date_interval', [
'reference_date' => $reference_date,
'interval' => $interval,
]);
$start_date = new \DateTimeImmutable($start_date, $timezone);
$expected_end_date = new \DateTimeImmutable($expected_next, $timezone);
$this
->assertEquals($expected_end_date, $plugin
->calculateDate($start_date));
$expected_start_date = new \DateTimeImmutable($expected_start, $timezone);
$this
->assertEquals($expected_start_date, $plugin
->calculateStart($start_date));
}