You are here

function CurrencyExchangerBartFeenstraCurrencyWebTestCase::testCurrencyExchangerBartFeenstraCurrency in Currency 7.2

Test currency exchange.

File

currency/tests/CurrencyConverterBartFeenstraCurrencyWebTestCase.test, line 35
Contains class CurrencyExchangerBartFeenstraCurrencyWebTestCase.

Class

CurrencyExchangerBartFeenstraCurrencyWebTestCase
Tests CurrencyExchangerBartFeenstraCurrency.

Code

function testCurrencyExchangerBartFeenstraCurrency() {

  // Test CurrencyExchangerBartFeenstraCurrency::load().
  // Test an available exchange rate.
  $this
    ->assertIdentical(CurrencyExchangerBartFeenstraCurrency::load('EUR', 'NLG'), '2.20371');

  // Test an unavailable exchange rate for which the reverse rate is
  // available.
  $this
    ->assertIdentical(round(CurrencyExchangerBartFeenstraCurrency::load('NLG', 'EUR'), 5), '0.45378');

  // Test CurrencyExchangerBartFeenstraCurrency::loadMultiple().
  // Test an available exchange rate.
  $rates = CurrencyExchangerBartFeenstraCurrency::loadMultiple(array(
    'EUR' => array(
      'NLG',
    ),
  ));
  $this
    ->assertTrue(isset($rates['EUR']));
  $this
    ->assertTrue(isset($rates['EUR']['NLG']));
  $this
    ->assertIdentical($rates['EUR']['NLG'], '2.20371');

  // Test an unavailable exchange rate for which the reverse rate is
  // available.
  $rates = CurrencyExchangerBartFeenstraCurrency::loadMultiple(array(
    'NLG' => array(
      'EUR',
    ),
  ));
  $this
    ->assertTrue(isset($rates['NLG']));
  $this
    ->assertTrue(isset($rates['NLG']['EUR']));
  $this
    ->assertIdentical(round($rates['NLG']['EUR'], 5), '0.45378');
}