/** * @return array */ private function getCountries() { if (!$this->defaultCountryCode) { $pairs = array(NULL => '- select country -'); } if ($this->allowedCountries === self::ALL) { /** @var Country $country */ foreach ($this->loader->loadCountries() as $country) { $pairs[$country->getAlpha2Code()] = $country->getShortName(); } } else { foreach ($this->allowedCountries as $countryCode) { $country = $this->loader->loadCountry($countryCode); $pairs[$country->getAlpha2Code()] = $country->getShortName(); } } return $pairs; }
/** * Make sure that we can retrieve a specific country. * * In addition to verifying that the country is returned, we also need * to make sure that all of the data has been properly set. Also, if a * country is not found, nothing (`null`) should be returned. */ public function testLoadCountry() { $this->checkCountry($this->loader->loadCountry('US')); $this->assertNull($this->loader->loadCountry('TEST'), 'No country should be returned.'); }