/** * @param DateTime|null $start * @return DateTime */ public function toDateTime(DateTime $start = null) { $start = $this->getNewStartDate($start); $end = parent::toDateTime($start); if ($this->holidays) { $span = new DateTimeSpan($start, $end); $span = $this->holidays->extendDateTimeSpan($span); return $span->getTo(); } return $end; }
/** * @covers ::extendBusinessDateTimeSpan * @dataProvider dataExtendBusinessDateTimeSpan */ public function testExtendBusinessDateTimeSpan($span, $start_date, $expected) { $holidays = new Holidays([new DateTime('2015-06-17'), new DateTime('2015-06-18'), new DateTime('2015-06-19'), new DateTime('2015-06-20'), new DateTime('2015-06-21')]); $result = $holidays->extendBusinessDateTimeSpan($span, $start_date); $this->assertEquals($expected, $result); }