mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Making built-in Canadian postal code validation accept postal codes with no spaces. Fixes #289
This commit is contained in:
parent
f389591085
commit
e6404f2d06
2 changed files with 2 additions and 1 deletions
|
@ -760,7 +760,7 @@ class Validation extends Object {
|
|||
$_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';
|
||||
break;
|
||||
case 'ca':
|
||||
$_this->regex = '/\\A\\b[ABCEGHJKLMNPRSTVXY][0-9][A-Z] [0-9][A-Z][0-9]\\b\\z/i';
|
||||
$_this->regex = '/\\A\\b[ABCEGHJKLMNPRSTVXY][0-9][A-Z] ?[0-9][A-Z][0-9]\\b\\z/i';
|
||||
break;
|
||||
case 'it':
|
||||
case 'de':
|
||||
|
|
|
@ -2121,6 +2121,7 @@ class ValidationTest extends CakeTestCase {
|
|||
$this->assertFalse(Validation::postal('B2A 2AB', null, 'ca'));
|
||||
$this->assertTrue(Validation::postal('X0A 0A2', null, 'ca'));
|
||||
$this->assertTrue(Validation::postal('G4V 4C3', null, 'ca'));
|
||||
$this->assertTrue(Validation::postal('L4J8D6', null, 'ca'));
|
||||
|
||||
$this->assertFalse(Validation::postal('111', null, 'us'));
|
||||
$this->assertFalse(Validation::postal('1111', null, 'us'));
|
||||
|
|
Loading…
Add table
Reference in a new issue