Skip to content

Instantly share code, notes, and snippets.

@marijn
Created May 15, 2010 14:51
Show Gist options
  • Save marijn/402231 to your computer and use it in GitHub Desktop.
Save marijn/402231 to your computer and use it in GitHub Desktop.
Dutch ZIP Code test written for PHPUnit
<?php
require_once 'PHPUnit/Framework.php';
class ZipCodeTest extends PHPUnit_Framework_TestCase
{
public function testDutchZipcodes ()
{
foreach (array('1017VN', '1017vn', '1017 VN', '1017 vn') as $zipCode)
{
preg_match ( '/^(\d{4}) ?([a-z]{2})$/i', $zipCode, $result);
$this->assertEquals('1017', $result[1]);
$this->assertEquals('VN', strtoupper($result[2]));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment