function EntityDefaultLanguageTest::setUp

Same name in other branches
  1. 8.9.x core/modules/language/tests/src/Kernel/EntityDefaultLanguageTest.php \Drupal\Tests\language\Kernel\EntityDefaultLanguageTest::setUp()
  2. 10 core/modules/language/tests/src/Kernel/EntityDefaultLanguageTest.php \Drupal\Tests\language\Kernel\EntityDefaultLanguageTest::setUp()
  3. 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\Kernel

Code

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',
    ]);
    $language->save();
    // Create a new content type which has Undefined language by default.
    $this->createContentType('ctund', LanguageInterface::LANGCODE_NOT_SPECIFIED);
    // Create a new content type which has Spanish language by default.
    $this->createContentType('ctes', 'es');
}

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