You are here

public function ConfigurableLanguageTest::testName in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php \Drupal\Tests\language\Kernel\ConfigurableLanguageTest::testName()

Tests configurable language name methods.

File

core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php, line 26

Class

ConfigurableLanguageTest
Tests the ConfigurableLanguage entity.

Namespace

Drupal\Tests\language\Kernel

Code

public function testName() {
  $name = $this
    ->randomMachineName();
  $language_code = $this
    ->randomMachineName(2);
  $configurableLanguage = new ConfigurableLanguage([
    'label' => $name,
    'id' => $language_code,
  ], 'configurable_language');
  $this
    ->assertEquals($name, $configurableLanguage
    ->getName());
  $this
    ->assertEquals('Test language', $configurableLanguage
    ->setName('Test language')
    ->getName());
}