Skip to content

Commit

Permalink
#13899 Improve unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
tadeobarranco authored and hitesh-wagento committed Jun 12, 2018
1 parent 8f03ac9 commit 2587e0f
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand All @@ -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)
Expand Down

0 comments on commit 2587e0f

Please sign in to comment.