/** * @covers ::offsetSet * @covers ::assertValidOffset */ public function testOffsetSet() { $range = new Range(10, 32); $range[0] = 8; $this->assertSame(8, $range->getMin()); $range[1] = 18; $this->assertSame(18, $range->getMax()); $this->setExpectedException('InvalidArgumentException', 'Offset must be 0 (for min) or 1 (for max) but was 3'); $range[3] = 9; }
/** * Return a new Range object with added min and max values * * @param Range $range */ public function add(Range $range) { return new Range($this->getMin() + $range->getMin(), $this->getMax() + $range->getMax(), $this->getFormat()); }