public function testIsGreaterThan() { $this->assertTrue(SpoonFilter::isGreaterThan(1, 10)); $this->assertTrue(SpoonFilter::isGreaterThan(-10, -1)); $this->assertTrue(SpoonFilter::isGreaterThan(-1, 10)); $this->assertFalse(SpoonFilter::isGreaterThan(1, -10)); $this->assertFalse(SpoonFilter::isGreaterThan(0, 0)); $this->assertTrue(SpoonFilter::isGreaterThan(array(), array(1))); }
/** * Checks if this field is greater than another value. * * @return bool * @param int $minimum The minimum. * @param string[optional] $error The error message to set. */ public function isGreaterThan($minimum, $error = null) { // filled if ($this->isFilled()) { // post/get data $data = $this->getMethod(true); // validate if (!isset($data[$this->attributes['name']]) || !SpoonFilter::isGreaterThan($minimum, $data[$this->attributes['name']])) { if ($error !== null) { $this->setError($error); } return false; } return true; } // not submitted if ($error !== null) { $this->setError($error); } return false; }