function ContentTranslationContextualLinksTest::testContentTranslationContextualLinks

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

Tests that a contextual link is available for translating a node.

File

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

Class

ContentTranslationContextualLinksTest
Tests that contextual links are available for content translation.

Namespace

Drupal\Tests\content_translation\FunctionalJavascript

Code

public function testContentTranslationContextualLinks() {
    $node = $this->drupalCreateNode([
        'type' => 'page',
        'title' => 'Test',
    ]);
    // Check that the translate link appears on the node page.
    $this->drupalLogin($this->translator);
    $this->drupalGet('node/' . $node->id());
    $link = $this->assertSession()
        ->waitForElement('css', '[data-contextual-id^="node:node=1"] .contextual-links a:contains("Translate")');
    $this->assertStringContainsString('node/1/translations', $link->getAttribute('href'));
}

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