function testIntInput()
 {
     $inp = new IntInput('anInt');
     $from = array('anInt' => '88');
     $r = $inp->getValue($from);
     $this->assertSame(88, $r);
 }
Exemplo n.º 2
0
 /**
  * Get fixed value of input setting.
  *
  * @return bool|float
  */
 public function getFixedValue()
 {
     $fixedValue = parent::getFixedValue();
     if (is_numeric($fixedValue)) {
         return floatval($fixedValue);
     } else {
         error_log('[getFixedValue] Invalid fixed float value: ' . var_export($fixedValue, true));
         return false;
     }
 }
 function checkInput($from)
 {
     $r = parent::checkInput($from);
     if (isError($r)) {
         return $r;
     }
     if (is_int($this->getValue($from)) && $this->getValue($from) > 0) {
         return true;
     } else {
         return new Error('INVALID_ID');
     }
 }