You are here

protected function PathWorkspacesTest::setUp in Drupal 8

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

Overrides BrowserTestBase::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() {
  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
    ->drupalPostForm('admin/config/regional/language/detection', $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
    ->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
  \Drupal::entityTypeManager()
    ->clearCachedDefinitions();
  $this
    ->setupWorkspaceSwitcherBlock();
}