Skip to content

Commit

Permalink
#13899 Improve unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
tadeobarranco committed Mar 2, 2018
1 parent 7c5ddee commit fa8b884
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 fa8b884

Please sign in to comment.