You are here

public function ConfigImporterTest::testImportCurrency in Currency 8.3

@covers ::importCurrency @covers ::createCurrencyFromRepository

File

tests/src/Unit/ConfigImporterTest.php, line 216

Class

ConfigImporterTest
@coversDefaultClass \Drupal\currency\ConfigImporter

Namespace

Drupal\Tests\currency\Unit

Code

public function testImportCurrency() {
  $resource_repository = new ResourceRepository();
  $currency_codes = $resource_repository
    ->listCurrencies();
  $currency_code = $currency_codes[array_rand($currency_codes)];
  $currency = $this
    ->createMock(CurrencyInterface::class);
  $this->currencyStorage
    ->expects($this
    ->atLeastOnce())
    ->method('create')
    ->with()
    ->willReturn($currency);
  $this->sut
    ->setConfigStorage($this->configStorage);
  $this
    ->assertSame($currency, $this->sut
    ->importCurrency($currency_code));
}