function CommentTranslationUITest::testTranslateLinkCommentAdminPage

Same name and namespace in other branches
  1. 9 core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::testTranslateLinkCommentAdminPage()
  2. 10 core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::testTranslateLinkCommentAdminPage()
  3. 11.x core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::testTranslateLinkCommentAdminPage()

Tests translate link on comment content admin page.

File

core/modules/comment/tests/src/Functional/CommentTranslationUITest.php, line 200

Class

CommentTranslationUITest
Tests the Comment Translation UI.

Namespace

Drupal\Tests\comment\Functional

Code

public function testTranslateLinkCommentAdminPage() {
    $this->adminUser = $this->drupalCreateUser(array_merge(parent::getTranslatorPermissions(), [
        'access administration pages',
        'administer comments',
        'skip comment approval',
    ]));
    $this->drupalLogin($this->adminUser);
    $cid_translatable = $this->createEntity([], $this->langcodes[0]);
    $cid_untranslatable = $this->createEntity([], $this->langcodes[0], 'comment');
    // Verify translation links.
    $this->drupalGet('admin/content/comment');
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertLinkByHref('comment/' . $cid_translatable . '/translations');
    $this->assertNoLinkByHref('comment/' . $cid_untranslatable . '/translations');
}

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