You are here

public function EntityDefaultLanguageTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/Tests/EntityDefaultLanguageTest.php \Drupal\language\Tests\EntityDefaultLanguageTest::setUp()

Performs setup tasks before each individual test method is run.

Overrides KernelTestBase::setUp

File

core/modules/language/src/Tests/EntityDefaultLanguageTest.php, line 31
Contains \Drupal\language\Tests\EntityDefaultLanguageTest.

Class

EntityDefaultLanguageTest
Tests default language code is properly generated for entities.

Namespace

Drupal\language\Tests

Code

public function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');

  // Activate Spanish language, so there are two languages activated.
  $language = $this->container
    ->get('entity.manager')
    ->getStorage('configurable_language')
    ->create(array(
    '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');
}