function CurrencyFilterWebTestCase::testCurrencyLocalze in Currency 7.2
Test the currency_localize input filter.
File
- currency/
tests/ CurrencyFilterWebTestCase.test, line 74 - Contains class CurrencyFilterWebTestCase.
Class
- CurrencyFilterWebTestCase
- Tests the currency exchange input filter.
Code
function testCurrencyLocalze() {
$tokens_valid = array(
'[currency-localize:EUR:100]' => '€100.00',
'[currency-localize:EUR:1.99]' => '€1.99',
'[currency-localize:EUR:2,99]' => '€2.99',
);
$tokens_invalid = array(
// Missing arguments.
'[currency-localize]',
'[currency-localize:]',
'[currency-localize::]',
'[currency-localize:EUR]',
// Invalid currency code.
'[currency-localize:123:456]',
// Invalid currency code and missing argument.
'[currency-localize:123]',
);
$format = new stdClass();
$format->format = 'currency_localize';
$format->name = 'Currency format';
$format->filters = array(
'currency_localize' => array(
'status' => TRUE,
),
);
filter_format_save($format);
foreach ($tokens_valid as $token => $replacement) {
$this
->assertIdentical(check_markup($token, $format->format), $replacement);
}
foreach ($tokens_invalid as $token) {
$this
->assertIdentical(check_markup($token, $format->format), $token);
}
}