validate() public static method

public static validate ( string $zipcode, string $country = null ) : boolean
$zipcode string
$country string
return boolean
Example #1
0
 public function testEmptyValuesByCountry()
 {
     foreach (ZipCode::getAvailableCountries() as $country) {
         foreach ($this->getEmptyValues() as $value) {
             $this->assertFalse(ZipCode::validate($value, $country), 'Empty value should be invalid.');
         }
     }
 }
Example #2
0
 /**
  * testUSZipCode
  *
  * @param mixed  $code
  * @param string $country
  * @param bool   $result
  *
  * @dataProvider zipCodes
  *
  * @return void
  */
 public function testUSZipCode($code, $country, $result)
 {
     $this->assertEquals(ZipCode::validate($code, $country), $result);
 }
Example #3
0
 /**
  * testZipCodeException
  *
  * @expectedException InvalidArgumentException
  *
  * @return void
  */
 public function testZipCodeException()
 {
     $this->assertEquals(ZipCode::validate('ABC12', 'Unkown'), $result);
 }