function ConfigurableLanguageTest::testName

Same name in other branches
  1. 9 core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php \Drupal\Tests\language\Kernel\ConfigurableLanguageTest::testName()
  2. 10 core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php \Drupal\Tests\language\Kernel\ConfigurableLanguageTest::testName()
  3. 11.x 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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.