function LanguageConfigurationElementTest::getDefaultLangcode

Same name and namespace in other branches
  1. 11.x core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php \Drupal\Tests\language\Functional\LanguageConfigurationElementTest::getDefaultLangcode()

Returns the default language code for a given entity type and bundle.

Return value

string The default language code.

1 call to LanguageConfigurationElementTest::getDefaultLangcode()
LanguageConfigurationElementTest::testDefaultLangcode in core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php
Tests that default langcode is correctly returned.

File

core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php, line 276

Class

LanguageConfigurationElementTest
Tests the features of the language configuration element field.

Namespace

Drupal\Tests\language\Functional

Code

protected function getDefaultLangcode() : string {
  // Create a dummy entity to easily access the langcode field default value.
  return EntityTest::create([
    'type' => 'custom_bundle',
  ])->get('langcode')->value;
}

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