/**
  * @covers edsonmedina\simpletype\NumericRange::__construct
  * @covers edsonmedina\simpletype\NumericRange::overlaps
  */
 public function testOverlaps()
 {
     $range1 = new NumericRange(10, 15);
     $range2 = new NumericRange(13, 30);
     $range3 = new NumericRange(5, 12);
     $range4 = new NumericRange(1, 50);
     $range5 = new NumericRange(100, 120);
     $this->assertTrue($range1->overlaps($range2));
     $this->assertTrue($range1->overlaps($range3));
     $this->assertTrue($range1->overlaps($range4));
     $this->assertFalse($range1->overlaps($range5));
     $this->assertFalse($range2->overlaps($range3));
 }
Esempio n. 2
0
 /**
  * Checks if ranges overlap
  * @param NumericRange $range
  * @return bool
  */
 public function overlaps(NumericRange $range)
 {
     return $range->getStartValue() <= $this->endValue && $range->getEndValue() >= $this->startValue;
 }