You are here

function CurrencyExchangerWebTestCase::testCurrencyExchanger in Currency 7.2

Test currency exchange.

We use CurrencyExchangerBartFeenstraCurrency to test some functionality, which means that if this test fails, the problem may be caused by CurrencyExchangerBartFeenstraCurrency.

See also

CurrencyExchangerBartFeenstraCurrency

File

currency/tests/CurrencyConverterWebTestCase.test, line 41
Contains class CurrencyExchangerWebTestCase.

Class

CurrencyExchangerWebTestCase
Tests CurrencyExchanger.

Code

function testCurrencyExchanger() {

  // Test default configuration.
  $this
    ->assertCurrencyExchangeRates();
  $this
    ->assertIdenticalCurrencyExchangeRates();

  // Test a configuration with explicitly enabled exchangers.
  CurrencyExchanger::saveConfiguration(array(
    'CurrencyExchangerFixedRates' => TRUE,
    'CurrencyExchangerBartFeenstraCurrency' => TRUE,
  ));
  $this
    ->assertCurrencyExchangeRates();
  $this
    ->assertIdenticalCurrencyExchangeRates();

  // Test a configuration with explicitly disabled exchangers.
  CurrencyExchanger::saveConfiguration(array(
    'CurrencyExchangerBartFeenstraCurrency' => FALSE,
    'CurrencyExchangerFixedRates' => FALSE,
  ));
  $this
    ->assertFalse(count(CurrencyExchanger::loadExchangers()));
  $this
    ->assertIdenticalCurrencyExchangeRates();
}