function PathWorkspacesTest::setUp

Same name and namespace in other branches
  1. 8.9.x 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()
  3. 11.x 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() : 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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.