From c02df2f672235076afe31d8165cd0dc740271e4c Mon Sep 17 00:00:00 2001 From: Bojan Zivanovic Date: Mon, 19 Jun 2023 12:40:05 +0200 Subject: [PATCH] Remove the postal code prefix for Switzerland. Fixes #96. --- src/AddressFormat/AddressFormatRepository.php | 1 - tests/Formatter/PostalLabelFormatterTest.php | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/AddressFormat/AddressFormatRepository.php b/src/AddressFormat/AddressFormatRepository.php index a1234bcc..b7833aee 100644 --- a/src/AddressFormat/AddressFormatRepository.php +++ b/src/AddressFormat/AddressFormatRepository.php @@ -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", diff --git a/tests/Formatter/PostalLabelFormatterTest.php b/tests/Formatter/PostalLabelFormatterTest.php index bd207c0e..7b26d346 100644 --- a/tests/Formatter/PostalLabelFormatterTest.php +++ b/tests/Formatter/PostalLabelFormatterTest.php @@ -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);