From bda63c768690b1a6d90a63e9b63dcaebf5247581 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 f0c7d4e1ff483..82318a3ec5068 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)