You are here

function LocaleResolverTest::testResolveCurrencyLocaleMissingFallback in Currency 8.3

@covers ::resolveCurrencyLocale

File

tests/src/Unit/LocaleResolverTest.php, line 176

Class

LocaleResolverTest
@coversDefaultClass \Drupal\currency\LocaleResolver

Namespace

Drupal\Tests\currency\Unit

Code

function testResolveCurrencyLocaleMissingFallback() {
  $this
    ->expectException(RuntimeException::class);
  $this
    ->prepareLanguageManager();
  $config = $this
    ->getMockBuilder(Config::class)
    ->disableOriginalConstructor()
    ->getMock();
  $config
    ->expects($this
    ->any())
    ->method('get')
    ->with('country.default')
    ->willReturn(NULL);
  $this->configFactory
    ->expects($this
    ->once())
    ->method('get')
    ->with('system.date')
    ->willReturn($config);
  $this->currencyLocaleStorage
    ->expects($this
    ->any())
    ->method('load')
    ->with(LocaleResolverInterface::DEFAULT_LOCALE)
    ->willReturn(NULL);

  // Test loading the fallback locale.
  $this->sut
    ->resolveCurrencyLocale();
}