You are here

protected function EntityDecoupledTranslationRevisionsTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 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() : void {
  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();
}