Business\Tests\BusinessTest::testTimelineWithHoursInterval PHP Method

testTimelineWithHoursInterval() public method

    public function testTimelineWithHoursInterval()
    {
        $business = new Business([new Day(Days::MONDAY, [['09:00', '13:00'], ['14:00', '17:00']]), new SpecialDay(Days::FRIDAY, function (\DateTime $date) {
            return [['10:00', '13:00'], ['14:00', '17:00']];
        })]);
        $start = new \DateTime('2015-05-25 11:30');
        $end = new \DateTime('2015-05-25 17:00');
        $dates = $business->timeline($start, $end, new \DateInterval('PT1H'));
        $this->assertEquals('2015-05-25 11:30', $dates[0]->format('Y-m-d H:i'));
        $this->assertEquals('2015-05-25 12:30', $dates[1]->format('Y-m-d H:i'));
        $this->assertEquals('2015-05-25 14:00', $dates[2]->format('Y-m-d H:i'));
        $this->assertEquals('2015-05-25 15:00', $dates[3]->format('Y-m-d H:i'));
        $this->assertEquals('2015-05-25 16:00', $dates[4]->format('Y-m-d H:i'));
        $this->assertEquals('2015-05-25 17:00', $dates[5]->format('Y-m-d H:i'));
    }