fix(BankPaymentValidator): check for negative identification number

This commit is contained in:
Ondrej Vlach 2024-01-18 13:50:08 +01:00
parent bf65ce058d
commit deacc6024b
Signed by: ovlach
GPG Key ID: 4FF1A23B4914DE70
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ class BankPaymentIdentificationNumberValidator extends ConstraintValidator
throw new UnexpectedValueException($value, "string");
}
if (strlen($value) <= 10 && filter_var($value, FILTER_VALIDATE_INT) !== false) {
if (strlen($value) <= 10 && filter_var($value, FILTER_VALIDATE_INT) !== false && (int) $value > 0) {
return ;
}

View File

@ -35,6 +35,6 @@ class BankPaymentIdentificationNumberValidatorTest extends ValidatorTestCase
}
private function failureDp(): array {
return [['122.b'], ['a.a'], ['a'], ['2.040'], ['2,a'], ['122.1'], ['12345678901']];
return [['122.b'], ['a.a'], ['a'], ['2.040'], ['2,a'], ['122.1'], ['12345678901'], ['-323']];
}
}