class ConfigurableLanguageTest in Drupal 10
Same name in this branch
- 10 core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php \Drupal\Tests\jsonapi\Functional\ConfigurableLanguageTest
- 10 core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php \Drupal\Tests\language\Kernel\ConfigurableLanguageTest
Same name and namespace in other branches
- 8 core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php \Drupal\Tests\language\Kernel\ConfigurableLanguageTest
- 9 core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php \Drupal\Tests\language\Kernel\ConfigurableLanguageTest
Tests the ConfigurableLanguage entity.
@group language
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\Tests\language\Kernel\ConfigurableLanguageTest
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\KernelView 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());
}
}