You are here

function CurrencyLocalePatternWebTestCase::testFormat in Currency 7.2

Test format().

File

currency/tests/CurrencyLocalePatternWebTestCase.test, line 59
Contains class CurrencyLocalePatternWebTestCase.

Class

CurrencyLocalePatternWebTestCase
Tests class CurrencyLocalePattern.

Code

function testFormat() {
  $currency = currency_load('EUR');
  $locale_pattern = new CurrencyLocalePattern(array(
    'pattern' => '¤-#,##0.00[XXX][999]',
    'symbol_decimal_separator' => ',',
    'symbol_grouping_separator' => '.',
  ));
  $amount = 12345.6789;
  $formatted = $locale_pattern
    ->format($currency, $amount);
  $formatted_expected = '€-12.345,6789EUR978';
  $this
    ->assertEqual($formatted, $formatted_expected);
}