Skip to content

Commit

Permalink
Remove the postal code prefix for Switzerland.
Browse files Browse the repository at this point in the history
Fixes #96.
  • Loading branch information
bojanz committed Jun 19, 2023
1 parent df10ee2 commit c02df2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/AddressFormat/AddressFormatRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ protected function getDefinitions(): array
],
'uppercase_fields' => [],
'postal_code_pattern' => '\d{4}',
'postal_code_prefix' => 'CH-',
],
'CI' => [
'format' => "%givenName %familyName\n%organization\n%sortingCode %addressLine1\n%addressLine2\n%addressLine3 %locality %sortingCode",
Expand Down
14 changes: 7 additions & 7 deletions tests/Formatter/PostalLabelFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,21 @@ public function testAddressLeadingPostPrefix(): void
{
$address = new Address();
$address = $address
->withCountryCode('CH')
->withLocality('Herrliberg')
->withPostalCode('8047');
->withCountryCode('HR')
->withLocality('Zagreb')
->withPostalCode('10105');

// Domestic mail shouldn't have the postal code prefix added.
$expectedLines = [
'8047 Herrliberg',
'10105 ZAGREB',
];
$formattedAddress = $this->formatter->format($address, ['origin_country' => 'CH']);
$formattedAddress = $this->formatter->format($address, ['origin_country' => 'HR']);
$this->assertFormattedAddress($expectedLines, $formattedAddress);

// International mail should have the postal code prefix added.
$expectedLines = [
'CH-8047 Herrliberg',
'SWITZERLAND',
'HR-10105 ZAGREB',
'CROATIA',
];
$formattedAddress = $this->formatter->format($address, ['origin_country' => 'FR']);
$this->assertFormattedAddress($expectedLines, $formattedAddress);
Expand Down

0 comments on commit c02df2f

Please sign in to comment.