You are here

public function ExchangerProviderPluginTest::testImportCrossSync in Commerce Exchanger 8

Test cross sync import.

::@covers ::import ::@covers ::buildExchangeRates ::@covers ::importCrossSync ::@covers ::processRemoteData ::@covers ::crossSyncCalculate ::@covers ::mapExchangeRates

File

tests/src/Kernel/ExchangerProviderPluginTest.php, line 98

Class

ExchangerProviderPluginTest
@coversDefaultClass \Drupal\commerce_exchanger\Plugin\Commerce\ExchangerProvider\ExchangerProviderRemoteBase @group commerce_exchanger

Namespace

Drupal\Tests\commerce_exchanger\Kernel

Code

public function testImportCrossSync() {
  $this->test
    ->import();
  $rates = $this->container
    ->get('commerce_exchanger.calculate')
    ->getExchangeRates();
  $this
    ->assertEqual(round(1 / 0.13, 6), $rates['HRK']['EUR']['value']);
  $this
    ->assertEqual(round(1 / 0.16, 6), $rates['HRK']['USD']['value']);
  $this
    ->assertEqual(0.13, $rates['EUR']['HRK']['value']);
  $this
    ->assertEqual(0.16, $rates['USD']['HRK']['value']);
}