/** * @return array */ public function getValueOptions() { if (!count($this->valueOptions)) { $names = Currency::getAvailableCurrencyNames(); $codes = $this->getCurrencyList()->getAllow(); $options = parent::getValueOptions(); foreach ($codes as $code) { $name = $this->getDisplayNames() ? $names[$code] : $code; $options[$code] = $name; } $this->setValueOptions($options); } return parent::getValueOptions(); }
/** * covers \NetglueMoney\Money\Currency::getAvailableCurrencyNames */ public function testGetAvailableCurencyNames() { $array = Currency::getAvailableCurrencyNames(); $this->assertInternalType('array', $array); $this->assertContainsOnly('string', $array); foreach ($array as $code => $name) { $this->assertRegExp('/^[A-Z]{3}$/', $code); } }