function LocaleResolverTest::testResolveCurrencyLocaleWithSiteDefaultCountry in Currency 8.3
@covers ::resolveCurrencyLocale
File
- tests/
src/ Unit/ LocaleResolverTest.php, line 114
Class
- LocaleResolverTest
- @coversDefaultClass \Drupal\currency\LocaleResolver
Namespace
Drupal\Tests\currency\UnitCode
function testResolveCurrencyLocaleWithSiteDefaultCountry() {
$this
->prepareLanguageManager();
$site_default_country = 'IN';
$config = $this
->getMockBuilder(Config::class)
->disableOriginalConstructor()
->getMock();
$config
->expects($this
->any())
->method('get')
->with('country.default')
->willReturn($site_default_country);
$this->configFactory
->expects($this
->once())
->method('get')
->with('system.date')
->willReturn($config);
$currency_locale = $this
->createMock(CurrencyLocaleInterface::class);
$this->currencyLocaleStorage
->expects($this
->any())
->method('load')
->with($this->languageManager
->getCurrentLanguage(Language::TYPE_CONTENT)
->getId() . '_' . $site_default_country)
->willReturn($currency_locale);
// Test loading the fallback locale.
$this
->assertSame($currency_locale, $this->sut
->resolveCurrencyLocale());
}