You are here

function CurrencyLocaleTest::testLabel in Currency 8.3

@covers ::label @covers ::getCountryManager

@depends testGetLocale

File

tests/src/Unit/Entity/CurrencyLocaleTest.php, line 137

Class

CurrencyLocaleTest
@coversDefaultClass \Drupal\currency\Entity\CurrencyLocale

Namespace

Drupal\Tests\currency\Unit\Entity

Code

function testLabel() {
  $languages = LanguageManager::getStandardLanguageList();
  $language_code = array_rand($languages);
  $country_code_a = strtoupper($this
    ->randomMachineName());
  $country_code_b = strtoupper($this
    ->randomMachineName());
  $country_code_c = strtoupper($this
    ->randomMachineName());
  $country_list = [
    $country_code_a => $this
      ->randomMachineName(),
    $country_code_b => $this
      ->randomMachineName(),
    $country_code_c => $this
      ->randomMachineName(),
  ];
  $this->countryManager
    ->expects($this
    ->atLeastOnce())
    ->method('getList')
    ->willReturn($country_list);
  $this->sut
    ->setLocale($language_code, $country_code_b);
  $this
    ->assertInstanceOf(TranslatableMarkup::class, $this->sut
    ->label());
}