function PathWorkspacesTest::setUp

Same name in other branches
  1. 9 core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php \Drupal\Tests\workspaces\Functional\PathWorkspacesTest::setUp()
  2. 8.9.x core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php \Drupal\Tests\workspaces\Functional\PathWorkspacesTest::setUp()
  3. 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 43

Class

PathWorkspacesTest
Tests path aliases with workspaces.

Namespace

Drupal\Tests\workspaces\Functional

Code

protected function setUp() : void {
    parent::setUp();
    static::createLanguageFromLangcode('ro');
    $this->rebuildContainer();
    // Create a content type.
    $this->drupalCreateContentType([
        'name' => 'article',
        'type' => 'article',
    ]);
    $permissions = [
        'administer languages',
        'administer nodes',
        'administer url aliases',
        'administer workspaces',
        'create article content',
        'create content translations',
        'edit any article content',
        'translate any entity',
    ];
    $this->drupalLogin($this->drupalCreateUser($permissions));
    // 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.
    static::enableContentTranslation('node', 'article');
    $this->setupWorkspaceSwitcherBlock();
    // The \Drupal\path_alias\AliasPrefixList service performs cache clears
    // after Drupal has flushed the response to the client. We use
    // WaitTerminateTestTrait to wait for Drupal to do this before continuing.
    $this->setWaitForTerminate();
}

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