Business\Tests\BusinessTest::testClosestBeforeWithHolidays PHP Method

testClosestBeforeWithHolidays() public method

    public function testClosestBeforeWithHolidays()
    {
        $target = new \DateTime('2015-05-11 08:00');
        // Monday
        $holidayOne = new \DateTime('2015-05-08');
        // Friday
        $holidayTwo = new \DateTime('2015-05-04');
        // Monday
        $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']];
        })], new Holidays([$holidayOne, $holidayTwo]));
        $date = $business->closest($target, Business::CLOSEST_LAST);
        $this->assertEquals('2015-05-01 17:00:00', $date->format('Y-m-d H:i:s'));
        // Last Friday
    }