You are here

public function ConfigImporterTest::testImportCurrencyLocale in Currency 8.3

@covers ::importCurrencyLocale

File

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

Class

ConfigImporterTest
@coversDefaultClass \Drupal\currency\ConfigImporter

Namespace

Drupal\Tests\currency\Unit

Code

public function testImportCurrencyLocale() {
  $locale = $this
    ->randomMachineName();
  $currency_locale_data = [
    'id' => $locale,
  ];
  $currency_locale = $this
    ->createMock(CurrencyLocaleInterface::class);
  $this->currencyLocaleStorage
    ->expects($this
    ->atLeastOnce())
    ->method('create')
    ->with($currency_locale_data)
    ->willReturn($currency_locale);
  $this->configStorage
    ->expects($this
    ->once())
    ->method('read')
    ->with('currency.currency_locale.' . $locale)
    ->willReturn($currency_locale_data);
  $this->sut
    ->setConfigStorage($this->configStorage);
  $this
    ->assertSame($currency_locale, $this->sut
    ->importCurrencyLocale($locale));
}