public function setIdRange($min, $max) { if (!is_numeric($min)) { throw new \InvalidArgumentException('Minimum ID must be numeric.'); } if (!is_numeric($max)) { throw new \InvalidArgumentException('Maximum ID must be numeric.'); } if ($min > $max) { throw new \InvalidArgumentException('Minimum ID cannot be larger than maximum ID.'); } $this->minid = $min; $this->maxid = $max; return $this; }
public function testFilterIdRange() { $sphinx = new SphinxClient(); $sphinx->setIdRange(2, 4); $results = $sphinx->query('bb'); $this->assertEquals(array_keys($results['matches']), array('4', '2', '3')); }