public function outside($from, $to, $include = false)
{
$from = (double) $from;
$to = (double) $to;
if ($this->isEmpty($from) || $this->isEmpty($to)) {
return '';
}
$extra = '';
if ($include) {
$extra = '=';
}
$from = $this->sanitiseValue($from);
$to = $this->sanitiseValue($to);
$sql = '((' . $this->getFieldName() . ' <' . $extra . ' ' . $from . ') OR ';
$sql .= '(' . $this->getFieldName() . ' >' . $extra . ' ' . $to . '))';
return $sql;
}
/** * @group NumberFilter * @group NumberFilterOutside * @covers FOF30\Model\DataModel\Filter\Number::outside * @dataProvider NumberDataprovider::getTestOutside */ public function testOutside($test, $check) { $msg = 'Number::outside %s - Case: ' . $check['case']; $filter = new Number(\JFactory::getDbo(), (object) array('name' => 'test', 'type' => 'int (10)')); $result = $filter->outside($test['from'], $test['to'], $test['inclusive']); $this->assertEquals($check['result'], $result, sprintf($msg, 'Failed to return the correct SQL')); }