You are here

public function ConfigImporterTest::testImportCurrencyWithExistingCurrency in Currency 8.3

@covers ::importCurrency

File

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

Class

ConfigImporterTest
@coversDefaultClass \Drupal\currency\ConfigImporter

Namespace

Drupal\Tests\currency\Unit

Code

public function testImportCurrencyWithExistingCurrency() {
  $currency_code = $this
    ->randomMachineName();
  $currency = $this
    ->createMock(CurrencyInterface::class);
  $this->currencyStorage
    ->expects($this
    ->never())
    ->method('create');
  $this->currencyStorage
    ->expects($this
    ->once())
    ->method('load')
    ->with($currency_code)
    ->willReturn($currency);
  $this->configStorage
    ->expects($this
    ->never())
    ->method('read');
  $this->sut
    ->setConfigStorage($this->configStorage);
  $this
    ->assertFalse($this->sut
    ->importCurrency($currency_code));
}