예제 #1
0
 function testConstructFromStartAndDuration()
 {
     $this->start->setReturnValue('add', $this->end);
     $this->start->expectOnce('add', array($this->duration));
     $range = new A_Datetime_Range($this->start, $this->duration);
     $this->assertEqual($range->getEnd(), $this->end);
 }
예제 #2
0
 /**
  * Checks whether or not the given Range object intersects this range
  *
  * @param A_Datetime_Range $range Range object to check
  * @return bool
  */
 public function intersects($range)
 {
     if (!$range || $this->end->getTimestamp() < $range->getStart()->getTimestamp() || $range->getEnd()->getTimestamp() < $this->start->getTimestamp()) {
         return false;
     }
     return true;
 }
예제 #3
0
 /**
  * check if this date/time a range or equal to the end dates
  */
 public function isWithinOrEqual(A_Datetime_Range $range)
 {
     return $this->getTimestamp() >= $range->getStart() && $this->getTimestamp() <= $range->getEnd();
 }