business\SpecialDay::getClosingTime PHP Method

getClosingTime() public method

public getClosingTime ( DateTime $context )
$context DateTime
    public function getClosingTime(\DateTime $context)
    {
        $this->evaluateOpeningIntervals($context);
        return parent::getClosingTime($context);
    }

Usage Example

Beispiel #1
0
 public function testGetClosingTime()
 {
     $monday = new \DateTime('2015-05-25');
     $tuesday = new \DateTime('2015-05-26');
     $day = new SpecialDay(Days::MONDAY, function (\DateTime $date) {
         if ('2015-05-25' == $date->format('Y-m-d')) {
             return [['14:00', '17:00'], ['06:00', '07:00']];
         }
         return [['12:00', '18:00']];
     });
     $this->assertEquals(17, $day->getClosingTime($monday)->getHours());
     $this->assertEquals(0, $day->getClosingTime($monday)->getMinutes());
     $this->assertEquals(18, $day->getClosingTime($tuesday)->getHours());
     $this->assertEquals(0, $day->getClosingTime($tuesday)->getMinutes());
 }