function ConfigEntityStorageTest::testCreateWithExplicitLanguage

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

@covers ::create @covers ::doCreate

File

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

Class

ConfigEntityStorageTest
@coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config

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.