Re: Validate, unit tests
| From: | A.L.E.C | Date: | Tue, 12 Oct 2010 08:22:22 +0000 |
| Subject: | Re: Validate, unit tests | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-53848@lists.php.net to get a copy of this message | ||
On 12.10.2010 02:44, Daniel O'Connor wrote:
> Hey all,
> Does anyone know enough about "iban" to get the validate_finance tests
> passing?
>
>
> http://test.pear.php.net:8080/cruisecontrol/buildresults/Validate
Link doesn't work, but I've made test myself. Here we go:
1) CS73260005601001611379
"CS" is not supported by the package and I think it's ok, because now we
have two countries instead (Serbia and Montenegro). However I've found
that for IBAN validator at http://www.tbg5-finance.org/?ibancheck.shtml
this number is valid. Here's the Javascript code
http://www.tbg5-finance.org/?ibandocs.shtml/
I didn't dig dipper.
2) MC1112739000700011111000h79
Fix for this is more general. All regexps are case sensitive, so we need
to use strtoupper() like in Validate_Finance_IBAN().
--- IBAN.php (wersja 304343)
+++ IBAN.php (kopia robocza)
@@ -455,7 +455,7 @@
if ( isset($this) && is_a($this, 'Validate_Finance_IBAN') ) {
$iban = $this->_iban;
} else {
- $iban = $arg;
+ $iban = strtoupper($arg);
}
$errorcode = VALIDATE_FINANCE_IBAN_OK;
3) MK07250120000058984
Here's a bug in regexp for Macedonia:
--- IBAN.php (wersja 304343)
+++ IBAN.php (kopia robocza)
@@ -384,7 +384,7 @@
'LV' => '/^LV[0-9]{2}[A-Z]{4}[A-Z0-9]{13}$/',
'MC' => '/^MC[0-9]{2}[0-9]{10}[A-Z0-9]{11}[0-9]{2}$/',
'ME' => '/^ME[0-9]{2}[0-9]{3}[0-9]{15}$/',
- 'MK' => '/^MK[0-9]{2}[A-Z]{3}[A-Z0-9]{10}[0-9]{2}$/',
+ 'MK' => '/^MK[0-9]{2}[0-9]{3}[A-Z0-9]{10}[0-9]{2}$/',
'MT' => '/^MT[0-9]{2}[A-Z]{4}[0-9]{5}[A-Z0-9]{18}$/',
'MU' => '/^MU[0-9]{2}[A-Z]{4}[0-9]{4}[0-9]{15}[A-Z]{3}$/',
'NL' => '/^NL[0-9]{2}[A-Z]{4}[0-9]{10}$/',
p.s. verified with
http://en.wikipedia.org/wiki/International_Bank_Account_Number
--
Aleksander 'A.L.E.C' Machniak http://alec.pl gg:2275252
LAN Management System Developer http://lms.org.pl
Roundcube Webmail Developer http://roundcube.net