ConfigurableLanguageTest.php in Drupal 9
File
core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php
View source
<?php
namespace Drupal\Tests\language\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
class ConfigurableLanguageTest extends KernelTestBase {
protected static $modules = [
'language',
];
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());
}
}