You are here

public function ConfigurableLanguageTest::testName in Drupal 8

Same name and namespace in other branches
  1. 9 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
    ->assertEqual($configurableLanguage
    ->getName(), $name);
  $this
    ->assertEqual($configurableLanguage
    ->setName('Test language')
    ->getName(), 'Test language');
}