-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Conversation
@@ -225,22 +225,20 @@ protected static function iban($countryCode, $prefix = '', $length = null) | |||
} | |||
} | |||
} | |||
if ($format === null) { | |||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove
Please add unit tests to prove the bugs, and to show that your PR fixes them. |
Ok, I'm working on this. The format is not to hard to test, but to test the checksum, the generator code would essentially have to be copied into the unit test, which sort of seems to defeat the purpose. An IBAN Checker (e.g. okj579/swiftery or globalcitizen/php-iban) could be added to the project to do the testing. This seems like a lot for a unit test, but I think probably the best option. Should I do that? |
You should move the checksum calculation to a standalone Calculator class (see the Luhn class), and reuse that class in your test. |
That's a much better idea. I've refactored it, so the checksum logic is done in Faker\Calculator\Iban (it is its own algorithm), which can also be tested with unit tests. |
Awesome, thanks! |
This fixes: