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 ::getCountryCodes */ public function testGetCountryCodesOnlyAccessesFilesystemOnce() { $addressService = new AddressService($this->options); $this->assertSame(['US', 'UK', 'DE', 'FR'], $addressService->getCountryCodes()); $this->root->removeChild($this->root->url() . '/country-codes.php'); $this->assertSame(['US', 'UK', 'DE', 'FR'], $addressService->getCountryCodes()); }