Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/100'
Browse files Browse the repository at this point in the history
Close #100
  • Loading branch information
michalbundyra committed Sep 22, 2019
2 parents 660232a + bc43f0a commit 1f8fd76
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ All notable changes to this project will be documented in this file, in reverse

- [#114](https://github.com/zendframework/zend-i18n/pull/114) fixes PHP 7.4 compatibility.

- [#100](https://github.com/zendframework/zend-i18n/pull/100) fixes regular expression in Liechtenstein postcode validator.

## 2.9.0 - 2018-05-16

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/PostCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class PostCode extends AbstractValidator
'LA' => '\d{5}',
'LV' => '(LV-)?\d{4}',
'LB' => '(\d{4}([ ]?\d{4})?)?',
'LI' => '(948[5-9])|(949[0-7])',
'LI' => '(948[5-9])|(949[0-8])',
'LT' => '\d{5}',
'LU' => '\d{4}',
'MK' => '\d{4}',
Expand Down
30 changes: 30 additions & 0 deletions test/Validator/PostCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,34 @@ public function testLvPostCodes()
$this->assertFalse($validator->isValid('ABCD'));
$this->assertFalse($validator->isValid('LV-ABCD'));
}

public function liPostCode()
{
yield 'Nendeln' => [9485];
yield 'Schaanwald' => [9486];
yield 'Gamprin-Bendern' => [9487];
yield 'Schellenberg' => [9488];
yield 'Vaduz-9489' => [9489];
yield 'Vaduz-9490' => [9490];
yield 'Ruggell' => [9491];
yield 'Eschen' => [9492];
yield 'Mauren' => [9493];
yield 'Schaan' => [9494];
yield 'Triesen' => [9495];
yield 'Balzers' => [9496];
yield 'Triesenberg' => [9497];
yield 'Planken' => [9498];
}

/**
* @dataProvider liPostCode
* @param int $postCode
*/
public function testLiPostCodes($postCode)
{
$validator = $this->validator;
$validator->setLocale('de_LI');

$this->assertTrue($validator->isValid($postCode));
}
}

0 comments on commit 1f8fd76

Please sign in to comment.