Exemplo n.º 1
0
 /**
  * @covers ::getLocale
  * @covers ::setLocale
  */
 public function testLocale()
 {
     $this->currency->setLocale('en');
     $this->assertEquals('en', $this->currency->getLocale());
 }
Exemplo n.º 2
0
 /**
  * Helper for initiating a new Currency object.
  */
 protected function createCurrency(array $definition, $locale = 'en')
 {
     $default = ['fraction_digits' => 2];
     $format = array_merge($default, $definition);
     $currency = new Currency();
     $currency->setCurrencyCode($format['code']);
     $currency->setName($format['name']);
     $currency->setNumericCode($format['numeric_code']);
     $currency->setFractionDigits($format['fraction_digits']);
     $currency->setSymbol($format['symbol']);
     $currency->setLocale($locale);
     return $currency;
 }
Exemplo n.º 3
0
 /**
  * Creates a currency object from the provided definition.
  *
  * @param array  $definition The currency definition.
  * @param string $locale     The locale of the currency definition.
  *
  * @return Currency
  */
 protected function createCurrencyFromDefinition(array $definition, $locale)
 {
     if (!isset($definition['fraction_digits'])) {
         $definition['fraction_digits'] = 2;
     }
     $currency = new Currency();
     $currency->setCurrencyCode($definition['code']);
     $currency->setName($definition['name']);
     $currency->setNumericCode($definition['numeric_code']);
     $currency->setFractionDigits($definition['fraction_digits']);
     $currency->setSymbol($definition['symbol']);
     $currency->setLocale($locale);
     return $currency;
 }