public function __construct(Block $block) { $layout = $block->getTimetable()->getLineConfig()->getLayoutConfig(); $extension = new CalendarExtension(); $this->hoursRange = $extension->calendarRange($layout); // add at least one empty frequency to show empty form if (count($block->getFrequencies()) == 0) { $frequency = new Frequency(); $block->setFrequencies(new ArrayCollection(array($frequency))); } }
/** * @dataProvider getCases */ public function testCalendarRange($layout, $expected) { $extension = new CalendarExtension(); $result = $extension->calendarRange($layout); $this->assertEquals($result, $expected); }