mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Added postal code verification for belgium, fixes #4192
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6948 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
065b8f4281
commit
0662d595cb
2 changed files with 7 additions and 0 deletions
|
@ -680,6 +680,9 @@ class Validation extends Object {
|
|||
default:
|
||||
$_this->regex = '/\\A\\b[0-9]{5}(?:-[0-9]{4})?\\b\\z/i';
|
||||
break;
|
||||
case 'be':
|
||||
$_this->regex = '/^[1-9]{1}[0-9]{3}$/i';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $_this->_check();
|
||||
|
|
|
@ -1416,6 +1416,10 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertFalse(Validation::postal('1111', null, 'de'));
|
||||
$this->assertTrue(Validation::postal('13089', null, 'de'));
|
||||
|
||||
$this->assertFalse(Validation::postal('111', null, 'be'));
|
||||
$this->assertFalse(Validation::postal('0123', null, 'be'));
|
||||
$this->assertTrue(Validation::postal('1204', null, 'be'));
|
||||
|
||||
$this->assertFalse(Validation::postal('111', null, 'it'));
|
||||
$this->assertFalse(Validation::postal('1111', null, 'it'));
|
||||
$this->assertTrue(Validation::postal('13089', null, 'it'));
|
||||
|
|
Loading…
Add table
Reference in a new issue