You are here

protected function ModerationContentTranslationTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/tests/src/Functional/ModerationContentTranslationTest.php \Drupal\Tests\content_moderation\Functional\ModerationContentTranslationTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/content_moderation/tests/src/Functional/ModerationContentTranslationTest.php, line 43

Class

ModerationContentTranslationTest
Test content_moderation functionality with content_translation.

Namespace

Drupal\Tests\content_moderation\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->drupalLogin($this->rootUser);

  // Create an Article content type.
  $this
    ->drupalCreateContentType([
    'type' => 'article',
    'name' => 'Article',
  ])
    ->save();
  $edit = [
    'predefined_langcode' => 'fr',
  ];
  $this
    ->drupalGet('admin/config/regional/language/add');
  $this
    ->submitForm($edit, 'Add language');

  // Enable content translation on articles.
  $this
    ->drupalGet('admin/config/regional/content-language');
  $edit = [
    'entity_types[node]' => TRUE,
    'settings[node][article][translatable]' => TRUE,
    'settings[node][article][settings][language][language_alterable]' => TRUE,
  ];
  $this
    ->submitForm($edit, 'Save configuration');

  // Adding languages requires a container rebuild in the test running
  // environment so that multilingual services are used.
  $this
    ->rebuildContainer();
}