function ContentTranslationContextualLinksTest::setUp

Same name in this branch
  1. 11.x core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationContextualLinksTest::setUp()
Same name in other branches
  1. 9 core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php \Drupal\Tests\content_translation\FunctionalJavascript\ContentTranslationContextualLinksTest::setUp()
  2. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationContextualLinksTest::setUp()
  3. 8.9.x core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php \Drupal\Tests\content_translation\FunctionalJavascript\ContentTranslationContextualLinksTest::setUp()
  4. 8.9.x core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationContextualLinksTest::setUp()
  5. 10 core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php \Drupal\Tests\content_translation\FunctionalJavascript\ContentTranslationContextualLinksTest::setUp()
  6. 10 core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationContextualLinksTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php, line 37

Class

ContentTranslationContextualLinksTest
Tests that contextual links are available for content translation.

Namespace

Drupal\Tests\content_translation\FunctionalJavascript

Code

protected function setUp() : void {
    parent::setUp();
    // Set up an additional language.
    ConfigurableLanguage::createFromLangcode('es')->save();
    // Create a content type.
    $this->drupalCreateContentType([
        'type' => 'page',
    ]);
    // Enable content translation.
    $content_translation_manager = $this->container
        ->get('content_translation.manager');
    $content_translation_manager->setEnabled('node', 'page', TRUE);
    $this->rebuildContainer();
    // Create a translator user.
    $permissions = [
        'access contextual links',
        'administer nodes',
        'edit any page content',
        'translate any entity',
    ];
    $this->translator = $this->drupalCreateUser($permissions);
}

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