Skip to content

Commit

Permalink
Fix REGON validation when checksum is equal to 10, add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Michał Mleczko committed Aug 10, 2017
1 parent dd1a6db commit ff2a8c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Kiczort/PolishValidator/RegonValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private function hasProperChecksumForShort($value)

$checksum = $sum % 11;

return $checksum == $chars[8];
return $checksum % 10 == $chars[8];
}

/**
Expand All @@ -64,6 +64,6 @@ private function hasProperChecksumForLong($value)

$checksum = $sum % 11;

return $checksum == $chars[13];
return $checksum % 10 == $chars[13];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ testValidation:
wrong_checksum2: [12345678512346, false]
proper_checksum: [123456785, true]
proper_checksum2: [12345678512347, true]
proper_checksum3: [251890090, true]
proper_checksum4: [55678259078290, true]

0 comments on commit ff2a8c0

Please sign in to comment.