コード例 #1
0
 /**
  * Implements corresponding isValidXX logic.
  *
  * @param string $context   Please see corresponding isValidXX description.
  * @param string $input     Please see corresponding isValidXX description.
  * @param int    $minValue  Please see corresponding isValidXX description.
  * @param int    $maxValue  Please see corresponding isValidXX description.
  * @param bool   $allowNull Please see corresponding isValidXX description.
  *
  * @return does not return a value.
  * @throws ValidationException thrown if input is invalid.
  * @throws IntrusionException thrown if intrusion is detected.
  */
 private function _assertValidNumber($context, $input, $minValue, $maxValue, $allowNull)
 {
     $nvr = new NumberValidationRule('NumberValidator', $this->_encoder, $minValue, $maxValue);
     $nvr->setAllowNull($allowNull);
     $nvr->assertValid($context, $input);
     return null;
 }
コード例 #2
0
 /**
  * test sanitize with empty input
  */
 function testNumberVR_sanitize_empty()
 {
     $nvr = new NumberValidationRule('A_Number', null, 0, PHP_INT_MAX);
     $this->assertTrue((double) 0 === $nvr->sanitize('testNumberVR_sanitize_empty', null));
     $this->assertTrue((double) 0 === $nvr->sanitize('testNumberVR_sanitize_empty', ''));
 }