You are here

public function ExchangeRateProviderDecoratorTest::testLoad in Currency 8.3

@covers ::load

File

tests/src/Unit/Plugin/Currency/ExchangeRateProvider/ExchangeRateProviderDecoratorTest.php, line 55

Class

ExchangeRateProviderDecoratorTest
@coversDefaultClass \Drupal\currency\Plugin\Currency\ExchangeRateProvider\ExchangeRateProviderDecorator

Namespace

Drupal\Tests\currency\Unit\Plugin\Currency\ExchangeRateProvider

Code

public function testLoad() {
  $source_currency_code = $this
    ->randomMachineName();
  $destination_currency_code = $this
    ->randomMachineName();
  $rate = mt_rand();
  $exchange_rate = new ExchangeRate($source_currency_code, $destination_currency_code, $rate, $this->pluginId);
  $this->exchangeRateProvider
    ->expects($this
    ->once())
    ->method('load')
    ->with($source_currency_code, $destination_currency_code)
    ->willReturn($exchange_rate);
  $this
    ->assertExchangeRateEquals($exchange_rate, $this->sut
    ->load($source_currency_code, $destination_currency_code));
}