function EntityDecoupledTranslationRevisionsTest::setUp

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php \Drupal\KernelTests\Core\Entity\EntityDecoupledTranslationRevisionsTest::setUp()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php \Drupal\KernelTests\Core\Entity\EntityDecoupledTranslationRevisionsTest::setUp()
  3. 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php \Drupal\KernelTests\Core\Entity\EntityDecoupledTranslationRevisionsTest::setUp()

Overrides EntityKernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php, line 83

Class

EntityDecoupledTranslationRevisionsTest
Test decoupled translation revisions.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function setUp() {
    parent::setUp();
    $entity_type_id = 'entity_test_mulrev';
    $this->installEntitySchema($entity_type_id);
    $this->storage = $this->container
        ->get('entity_type.manager')
        ->getStorage($entity_type_id);
    $this->installConfig([
        'language',
    ]);
    $langcodes = [
        'it',
        'fr',
    ];
    foreach ($langcodes as $langcode) {
        ConfigurableLanguage::createFromLangcode($langcode)->save();
    }
    $values = [
        'name' => $this->randomString(),
        'status' => 1,
    ];
    User::create($values)->save();
    // Make sure entity bundles are translatable.
    $this->state
        ->set('entity_test.translation', TRUE);
    $this->bundleInfo = \Drupal::service('entity_type.bundle.info');
    $this->bundleInfo
        ->clearCachedBundles();
}

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