You are here

class ConfigurableLanguageTest in Drupal 10

Same name in this branch
  1. 10 core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php \Drupal\Tests\jsonapi\Functional\ConfigurableLanguageTest
  2. 10 core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php \Drupal\Tests\language\Kernel\ConfigurableLanguageTest
Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php \Drupal\Tests\language\Kernel\ConfigurableLanguageTest
  2. 9 core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php \Drupal\Tests\language\Kernel\ConfigurableLanguageTest

Tests the ConfigurableLanguage entity.

@group language

Hierarchy

Expanded class hierarchy of ConfigurableLanguageTest

See also

\Drupal\language\Entity\ConfigurableLanguage.

File

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

Namespace

Drupal\Tests\language\Kernel
View source
class ConfigurableLanguageTest extends KernelTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  protected static $modules = [
    'language',
  ];

  /**
   * Tests configurable language name methods.
   */
  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());
  }

}

Members