public function testConstruction() { $countries = new Countries(); $dataSet = (include 'dataSet.php'); foreach ($dataSet as $term => $desired) { $result = $countries->getCountry($term); $msg = '"%s" was expecting iso "%s" but got "%s" for "%s"'; $msg = sprintf($msg, $term, $desired, $result['iso2'], $result['name']); $this->assertEquals($desired, $result['iso2'], $msg); } }
public function testUSTerritories() { $countries = new Countries(); $this->assertTrue($countries->isUSTerritory('Guam')); $this->assertTrue($countries->isUSTerritory('Northern Mariana Islands')); $this->assertTrue($countries->isUSTerritory('Puerto Rico')); $this->assertTrue($countries->isUSTerritory('US Virgin Islands')); $this->assertTrue($countries->isUSTerritory('Micronesia')); $this->assertTrue($countries->isUSTerritory('Northern Mariana Islands')); $this->assertTrue($countries->isUSTerritory('Palau')); $this->assertTrue($countries->isUSTerritory('American Samoa')); $this->assertTrue($countries->isUSTerritory('PR')); $this->assertFalse($countries->isUSTerritory('Canada')); $this->assertFalse($countries->isUSTerritory('')); }