function EntityDefaultLanguageTest::setUp
Same name in other branches
- 9 core/modules/language/tests/src/Kernel/EntityDefaultLanguageTest.php \Drupal\Tests\language\Kernel\EntityDefaultLanguageTest::setUp()
- 8.9.x core/modules/language/tests/src/Kernel/EntityDefaultLanguageTest.php \Drupal\Tests\language\Kernel\EntityDefaultLanguageTest::setUp()
- 11.x core/modules/language/tests/src/Kernel/EntityDefaultLanguageTest.php \Drupal\Tests\language\Kernel\EntityDefaultLanguageTest::setUp()
Overrides KernelTestBase::setUp
File
-
core/
modules/ language/ tests/ src/ Kernel/ EntityDefaultLanguageTest.php, line 33
Class
- EntityDefaultLanguageTest
- Tests default language code is properly generated for entities.
Namespace
Drupal\Tests\language\KernelCode
protected function setUp() : void {
parent::setUp();
$this->installEntitySchema('user');
// Activate Spanish language, so there are two languages activated.
$language = $this->container
->get('entity_type.manager')
->getStorage('configurable_language')
->create([
'id' => 'es',
'label' => 'Spanish',
]);
$language->save();
// Create a new content type which has Undefined language by default.
$this->createContentType('content_und', LanguageInterface::LANGCODE_NOT_SPECIFIED);
// Create a new content type which has Spanish language by default.
$this->createContentType('content_es', 'es');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.