function ConfigEntityStorageTest::testCreateWithExplicitLanguage

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithExplicitLanguage()
  2. 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithExplicitLanguage()
  3. 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithExplicitLanguage()
  4. 8.9.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithExplicitLanguage()

Tests create with explicit language.

@legacy-covers ::create @legacy-covers ::doCreate

File

core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php, line 236

Class

ConfigEntityStorageTest
Tests Drupal\Core\Config\Entity\ConfigEntityStorage.

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function testCreateWithExplicitLanguage() : void {
  $this->languageManager
    ->getLanguage('en')
    ->willReturn(new Language([
    'id' => 'en',
  ]));
  $entity = $this->entityStorage
    ->create([
    'id' => 'foo',
    'langcode' => 'en',
  ]);
  $this->assertSame('en', $entity->language()
    ->getId());
}

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