You are here

protected function PathWorkspacesTest::setUp in Drupal 10

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

File

core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php, line 38

Class

PathWorkspacesTest
Tests path aliases with workspaces.

Namespace

Drupal\Tests\workspaces\Functional

Code

protected function setUp() : void {
  parent::setUp();
  ConfigurableLanguage::createFromLangcode('ro')
    ->save();
  $this
    ->rebuildContainer();

  // Create a content type.
  $this
    ->drupalCreateContentType([
    'name' => 'article',
    'type' => 'article',
  ]);
  $this
    ->drupalLogin($this->rootUser);

  // Enable URL language detection and selection.
  $edit = [
    'language_interface[enabled][language-url]' => 1,
  ];
  $this
    ->drupalGet('admin/config/regional/language/detection');
  $this
    ->submitForm($edit, 'Save settings');

  // Enable translation for article node.
  $edit = [
    'entity_types[node]' => 1,
    'settings[node][article][translatable]' => 1,
    'settings[node][article][fields][path]' => 1,
    'settings[node][article][fields][body]' => 1,
    'settings[node][article][settings][language][language_alterable]' => 1,
  ];
  $this
    ->drupalGet('admin/config/regional/content-language');
  $this
    ->submitForm($edit, 'Save configuration');
  \Drupal::entityTypeManager()
    ->clearCachedDefinitions();
  $this
    ->setupWorkspaceSwitcherBlock();
}