. */ namespace Tests\unit\Support\Calendar\Periodicity; use FireflyIII\Support\Calendar\Periodicity\Interval; use PHPUnit\Framework\TestCase; abstract class IntervalTestCase extends TestCase { abstract public static function factory(): Interval; public abstract static function provideIntervals(): array; public static function provider(): \Generator { $intervals = static::provideIntervals(); /** @var IntervalProvider $interval */ foreach ($intervals as $interval) { yield "{$interval->label}" => [$interval]; } } /** * @dataProvider provider * @param IntervalProvider $provider * @return void */ public function testGivenAnEpochWhenCallTheNextDateThenReturnsTheExpectedDateSuccessful(IntervalProvider $provider): void { $period = static::factory()->nextDate($provider->epoch); $this->assertEquals($provider->expected->toDateString(), $period->toDateString()); } }