You are here

protected function EntityDefaultLanguageTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 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');
}