From 2587e0f5f11405aedc431d71542db2ae85af9522 Mon Sep 17 00:00:00 2001 From: Tadeo Barranco Date: Fri, 2 Mar 2018 16:09:26 -0600 Subject: [PATCH] #13899 Improve unit test --- .../Model/Country/Postcode/ValidatorTest.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) 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 6c574ddac81c6..a2287bafdb9f1 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 @@ -50,13 +50,10 @@ public function testInvalidCanadaZipCode($countryId, $invalidPostCode) { } /** - * + * @dataProvider getCanadaValidPostCodes */ - public function testValidCanadaZipCode() { - $resultPattern1 = $this->validator->validate('A1B2C3', 'CA'); - $resultPattern2 = $this->validator->validate('A1B 2C3', 'CA'); - $this->assertTrue($resultPattern1); - $this->assertTrue($resultPattern2); + public function testValidCanadaZipCode($countryId, $validPostCode) { + $this->assertTrue($this->validator->validate($validPostCode, $countryId)); } /** @@ -71,6 +68,18 @@ public function getCanadaInvalidPostCodes() { ]; } + /** + * @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)