Skip to content

Commit fa8b884

Browse files
committed
#13899 Improve unit test
1 parent 7c5ddee commit fa8b884

File tree

1 file changed

+15
-6
lines changed
  • dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode

1 file changed

+15
-6
lines changed

dev/tests/integration/testsuite/Magento/Directory/Model/Country/Postcode/ValidatorTest.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,10 @@ public function testInvalidCanadaZipCode($countryId, $invalidPostCode) {
5050
}
5151

5252
/**
53-
*
53+
* @dataProvider getCanadaValidPostCodes
5454
*/
55-
public function testValidCanadaZipCode() {
56-
$resultPattern1 = $this->validator->validate('A1B2C3', 'CA');
57-
$resultPattern2 = $this->validator->validate('A1B 2C3', 'CA');
58-
$this->assertTrue($resultPattern1);
59-
$this->assertTrue($resultPattern2);
55+
public function testValidCanadaZipCode($countryId, $validPostCode) {
56+
$this->assertTrue($this->validator->validate($validPostCode, $countryId));
6057
}
6158

6259
/**
@@ -71,6 +68,18 @@ public function getCanadaInvalidPostCodes() {
7168
];
7269
}
7370

71+
/**
72+
* @return array
73+
*/
74+
public function getCanadaValidPostCodes() {
75+
return [
76+
['countryId' => 'CA', 'postcode' => 'A1B2C3'],
77+
['countryId' => 'CA', 'postcode' => 'A1B 2C3'],
78+
['countryId' => 'CA', 'postcode' => 'Z9Y 8X7'],
79+
['countryId' => 'CA', 'postcode' => 'Z9Y8X7'],
80+
];
81+
}
82+
7483
/**
7584
* @return array
7685
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)

0 commit comments

Comments
 (0)