function CurrencyExchangerWebTestCase::assertCurrencyExchangeRates in Currency 7.2
Asserts that exchange rates can be retrieved.
This function expects CurrencyExchangerFixedRates and CurrencyExchangerBartFeenstraCurrency to be enabled in that order.
1 call to CurrencyExchangerWebTestCase::assertCurrencyExchangeRates()
- CurrencyExchangerWebTestCase::testCurrencyExchanger in currency/
tests/ CurrencyConverterWebTestCase.test - Test currency exchange.
File
- currency/
tests/ CurrencyConverterWebTestCase.test, line 69 - Contains class CurrencyExchangerWebTestCase.
Class
- CurrencyExchangerWebTestCase
- Tests CurrencyExchanger.
Code
function assertCurrencyExchangeRates() {
$exchangers = CurrencyExchanger::loadExchangers();
$this
->assertEqual(CurrencyExchanger::loadExchangers(), array(
'CurrencyExchangerFixedRates',
'CurrencyExchangerBartFeenstraCurrency',
));
// Make sure the first exchanger has a rate on EUR>NLG, so it has
// priority over the second exchanger's rate for these currencies.
CurrencyExchangerFixedRates::save('EUR', 'NLG', '7');
// Test CurrencyExchanger::load().
$this
->assertIdentical(CurrencyExchanger::load('EUR', 'NLG'), '7');
$this
->assertIdentical(CurrencyExchanger::load('EUR', 'DEM'), '1.95583');
$this
->assertFalse(CurrencyExchanger::load('EUR', 'XXX'));
// Test CurrencyExchanger::loadMultiple().
$rates = CurrencyExchanger::loadMultiple(array(
'EUR' => array(
'NLG',
'DEM',
'XXX',
),
));
$this
->assertTrue(isset($rates['EUR']));
$this
->assertTrue(isset($rates['EUR']['NLG']));
$this
->assertIdentical($rates['EUR']['NLG'], '7');
$this
->assertTrue(isset($rates['EUR']['DEM']));
$this
->assertIdentical($rates['EUR']['DEM'], '1.95583');
$this
->assertTrue(isset($rates['EUR']['XXX']));
$this
->assertFalse($rates['EUR']['XXX']);
}