function EntityRepositoryTest::setUp

Same name in this branch
  1. 10 core/tests/Drupal/Tests/Core/Entity/EntityRepositoryTest.php \Drupal\Tests\Core\Entity\EntityRepositoryTest::setUp()
Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityRepositoryTest::setUp()
  2. 9 core/tests/Drupal/Tests/Core/Entity/EntityRepositoryTest.php \Drupal\Tests\Core\Entity\EntityRepositoryTest::setUp()
  3. 8.9.x core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityRepositoryTest::setUp()
  4. 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityRepositoryTest.php \Drupal\Tests\Core\Entity\EntityRepositoryTest::setUp()
  5. 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityRepositoryTest::setUp()
  6. 11.x core/tests/Drupal/Tests/Core/Entity/EntityRepositoryTest.php \Drupal\Tests\Core\Entity\EntityRepositoryTest::setUp()

Overrides KernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php, line 50

Class

EntityRepositoryTest
Tests the entity repository.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function setUp() : void {
    parent::setUp();
    $this->entityTypeManager = $this->container
        ->get('entity_type.manager');
    $this->entityRepository = $this->container
        ->get('entity.repository');
    $this->setUpCurrentUser();
    $this->installEntitySchema('entity_test');
    $this->installEntitySchema('entity_test_rev');
    $this->installEntitySchema('entity_test_mul');
    $this->installEntitySchema('entity_test_mulrev');
    $this->installConfig([
        'system',
        'language',
    ]);
    ConfigurableLanguage::createFromLangcode('it')->setWeight(1)
        ->save();
    ConfigurableLanguage::createFromLangcode('ro')->setWeight(2)
        ->save();
    $this->container
        ->get('state')
        ->set('entity_test.translation', TRUE);
    $this->container
        ->get('entity_type.bundle.info')
        ->clearCachedBundles();
}

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