You are here

protected function TranslationTest::setUp in Inline Entity Form 8

Overrides InlineEntityFormTestBase::setUp

File

tests/src/FunctionalJavascript/TranslationTest.php, line 28

Class

TranslationTest
Tests translating inline entities.

Namespace

Drupal\Tests\inline_entity_form\FunctionalJavascript

Code

protected function setUp() : void {
  parent::setUp();
  $this->user = $this
    ->createUser([
    'create ief_reference_type content',
    'edit any ief_reference_type content',
    'delete any ief_reference_type content',
    'create ief_test_complex content',
    'edit any ief_test_complex content',
    'delete any ief_test_complex content',
    'view own unpublished content',
    'administer content translation',
    'translate any entity',
    'create content translations',
    'administer languages',
  ]);
  $this
    ->drupalLogin($this->user);

  // Allow referencing existing entities.
  $form_display_storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('entity_form_display');

  /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $display */
  $display = $form_display_storage
    ->load('node.ief_test_complex.default');
  $component = $display
    ->getComponent('multi');
  $component['settings']['allow_existing'] = TRUE;
  $display
    ->setComponent('multi', $component)
    ->save();
}