Business\Tests\BusinessTest::testClosestAfterCustomTimezone PHP Method

testClosestAfterCustomTimezone() public method

    public function testClosestAfterCustomTimezone()
    {
        $tz = date_default_timezone_get();
        date_default_timezone_set('Europe/Paris');
        $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']];
        })]);
        // Monday "2015-05-25 22:00:00" in Europe/Paris
        $date = new \DateTime('2015-05-25 10:00', new \DateTimeZone('Pacific/Tahiti'));
        $closest = $business->closest($date, Business::CLOSEST_NEXT);
        $this->assertEquals('2015-05-29 10:00', $closest->format('Y-m-d H:i'));
        // Next Friday
        date_default_timezone_set($tz);
    }