Merge branch '1.0'

This commit is contained in:
Henrique Moody 2015-11-25 18:05:51 -02:00
commit 799228a6e0
3 changed files with 8 additions and 4 deletions

View file

@ -5,9 +5,11 @@
Validates a postal code according to the given country code.
```php
v::numeric()->postalCode('BR')->validate('02179000'); // true
v::numeric()->postalCode('BR')->validate('02179-000'); // true
v::numeric()->postalCode('US')->validate('02179-000'); // false
v::postalCode('BR')->validate('02179000'); // true
v::postalCode('BR')->validate('02179-000'); // true
v::postalCode('US')->validate('02179-000'); // false
v::postalCode('US')->validate('55372'); // true
v::postalCode('PL')->validate('99-300'); // true
```
Message template for this validator includes `{{countryCode}}`.

View file

@ -131,7 +131,7 @@ class PostalCode extends Regex
'PG' => "/^(\d{3})$/",
'PH' => "/^(\d{4})$/",
'PK' => "/^(\d{5})$/",
'PL' => "/^(\d{5})$/",
'PL' => "/^(\d{2}-\d{3})$/",
'PM' => '/^(97500)$/',
'PR' => "/^(\d{9})$/",
'PT' => "/^(\d{7})$/",

View file

@ -90,6 +90,7 @@ class PostalCodeTest extends \PHPUnit_Framework_TestCase
['GB', 'PR1 9LY'],
['US', '02179'],
['YE', ''],
['PL', '99-300'],
];
}
@ -123,6 +124,7 @@ class PostalCodeTest extends \PHPUnit_Framework_TestCase
['GB', 'PR19LY'],
['US', '021 79'],
['YE', '02179'],
['PL', '99300'],
];
}
}