public function getValueOptions() { if ($this->valueOptions !== null) { return $this->valueOptions; } $countryCodes = $this->addressService->getCountryCodes(); $valueOptions = []; foreach ($countryCodes as $countryCode) { $valueOptions[$countryCode] = $this->countryCodeFormatter->format($countryCode); } $this->setValueOptions($valueOptions); return $this->valueOptions; }
/** * @covers ::format */ public function testFormatThrowsExceptionOnInvalidCountryCode() { $this->setExpectedException('UnexpectedValueException', 'Invalid country code provided: "foobar"'); $formatter = new CountryCodeFormatter('en-US'); $formatter->format('foobar'); }