Perform an interval match. It's similar to a 'between' match, but the
from and to values are calculated based on $value and $interval:
$value - $interval < VALUE < $value + $interval
public interval ( integer | float $value, integer | float $interval, boolean $include = true ) : string | ||
$value | integer | float | The center value of the search space |
$interval | integer | float | The width of the search space |
$include | boolean | Should I include the boundaries in the search? |
return | string | The SQL where clause |
/** * @group NumberFilter * @group NumberFilterInterval * @covers FOF30\Model\DataModel\Filter\Number::interval * @dataProvider NumberDataprovider::getTestInterval */ public function testInterval($test, $check) { $msg = 'Number::interval %s - Case: ' . $check['case']; $filter = new Number(\JFactory::getDbo(), (object) array('name' => 'test', 'type' => 'int (10)')); $result = $filter->interval($test['value'], $test['interval'], $test['inclusive']); $this->assertEquals($check['result'], $result, sprintf($msg, 'Failed to return the correct SQL')); }