public function testGetCurrenciesData() { $currencies = StubLocale::getCurrenciesData('en'); $this->assertEquals('R$', $currencies['BRL']['symbol']); $this->assertEquals('Brazilian Real', $currencies['BRL']['name']); $this->assertEquals(2, $currencies['BRL']['fractionDigits']); $this->assertEquals(0, $currencies['BRL']['roundingIncrement']); }
/** * Get currency symbol * * @param string $code * @return string */ public function getCurrencySymbol($code) { if (empty($this->currencies)) { $this->currencies = StubLocale::getCurrenciesData('en'); } if (isset($this->currencies[$code]['symbol'])) { return $this->currencies[$code]['symbol']; } }
public function testGetCurrenciesData() { $symbol = $this->isSameAsIcuVersion('4.8') ? 'BR$' : 'R$'; $currencies = StubLocale::getCurrenciesData('en'); $this->assertEquals($symbol, $currencies['BRL']['symbol']); $this->assertEquals('Brazilian Real', $currencies['BRL']['name']); $this->assertEquals(2, $currencies['BRL']['fractionDigits']); $this->assertEquals(0, $currencies['BRL']['roundingIncrement']); }
/** * Returns the rounding increment of a currency * * @param string $currency The 3-letter ISO 4217 currency code indicating the currency to use * * @return string The rounding increment of a currency */ private function getCurrencyRoundingIncrement($currency) { $currencies = StubLocale::getCurrenciesData($this->locale); return $currencies[$currency]['roundingIncrement']; }