Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug #18291 Lax postcode validation doesn't work

git-svn-id: http://svn.php.net/repository/pear/packages/Validate/trunk@308558 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 1b5c3da7bd29b05e778e8ec79d1f00eef28ed1f8 1 parent e51a35e
@CloCkWeRX CloCkWeRX authored
Showing with 35 additions and 2 deletions.
  1. +35 −2 tests/Validate_NZ.phpt
View
37 tests/Validate_NZ.phpt
@@ -143,7 +143,12 @@ $Carreg = array("AE12Y3", //Ok
"ABCDEF", //NOk
"AI14W"); //OK
-echo "----Test postalCode----\n";
+echo "----Test postalCode (lax)----\n";
+foreach ($postalCodes as $postalCode) {
+ echo "{$postalCode}: ".$noYes[Validate_NZ::postalCode($postalCode, false)]."\n";
+}
+
+echo "----Test postalCode (strict)----\n";
foreach ($postalCodes as $postalCode) {
echo "{$postalCode}: ".$noYes[Validate_NZ::postalCode($postalCode,true)]."\n";
}
@@ -180,7 +185,35 @@ foreach ($Carreg as $Car) {
Test Validate_NZ
****************
-----Test postalCode----
+----Test postalCode (lax)----
+0110: YES
+1010: YES
+0000: YES
+1501: YES
+1111: YES
+0800: YES
+011: NO
+a112: NO
+101010: NO
+O1lO: NO
+0610: YES
+0600: YES
+2012: YES
+2105: YES
+0505: YES
+1081: YES
+1022: YES
+2102: YES
+2010: YES
+2022: YES
+2013: YES
+0630: YES
+0614: YES
+0612: YES
+2014: YES
+1025: YES
+0931: YES
+----Test postalCode (strict)----
0110: YES
1010: YES
0000: NO
Please sign in to comment.
Something went wrong with that request. Please try again.