diff --git a/app/code/Magento/Directory/etc/zip_codes.xml b/app/code/Magento/Directory/etc/zip_codes.xml
index 18e13ca5bb48b..c4899636b4b30 100644
--- a/app/code/Magento/Directory/etc/zip_codes.xml
+++ b/app/code/Magento/Directory/etc/zip_codes.xml
@@ -81,6 +81,7 @@
^[a-zA-z]{1}[0-9]{1}[a-zA-z]{1}\s[0-9]{1}[a-zA-z]{1}[0-9]{1}$
+ ^[a-zA-z]{1}[0-9]{1}[a-zA-z]{1}[0-9]{1}[a-zA-z]{1}[0-9]{1}$
diff --git a/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/ValidatorTest.php b/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/ValidatorTest.php
index ad2e6c6c4e235..d2274c2169145 100644
--- a/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/ValidatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/ValidatorTest.php
@@ -42,6 +42,48 @@ public function testPostCodesThrowsExceptionIfCountryDoesNotExist()
$this->validator->validate('12345', 'INVALID-CODE');
}
+ /**
+ * @dataProvider getCanadaInvalidPostCodes
+ */
+ public function testInvalidCanadaZipCode($countryId, $invalidPostCode)
+ {
+ $this->assertFalse($this->validator->validate($invalidPostCode, $countryId));
+ }
+
+ /**
+ * @dataProvider getCanadaValidPostCodes
+ */
+ public function testValidCanadaZipCode($countryId, $validPostCode)
+ {
+ $this->assertTrue($this->validator->validate($validPostCode, $countryId));
+ }
+
+ /**
+ * @return array
+ */
+ public function getCanadaInvalidPostCodes()
+ {
+ return [
+ ['countryId' => 'CA', 'postcode' => '12345'],
+ ['countryId' => 'CA', 'postcode' => 'A1B2C3D'],
+ ['countryId' => 'CA', 'postcode' => 'A1B2C'],
+ ['countryId' => 'CA', 'postcode' => 'A1B 2C3'],
+ ];
+ }
+
+ /**
+ * @return array
+ */
+ public function getCanadaValidPostCodes()
+ {
+ return [
+ ['countryId' => 'CA', 'postcode' => 'A1B2C3'],
+ ['countryId' => 'CA', 'postcode' => 'A1B 2C3'],
+ ['countryId' => 'CA', 'postcode' => 'Z9Y 8X7'],
+ ['countryId' => 'CA', 'postcode' => 'Z9Y8X7'],
+ ];
+ }
+
/**
* @return array
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)