function CommentTranslationUITest::testTranslateLinkCommentAdminPage

Same name in other branches
  1. 9 core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::testTranslateLinkCommentAdminPage()
  2. 8.9.x core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::testTranslateLinkCommentAdminPage()
  3. 10 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 205

Class

CommentTranslationUITest
Tests the Comment Translation UI.

Namespace

Drupal\Tests\comment\Functional

Code

public function testTranslateLinkCommentAdminPage() : void {
    $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->assertSession()
        ->linkByHrefExists('comment/' . $cid_translatable . '/translations');
    $this->assertSession()
        ->linkByHrefNotExists('comment/' . $cid_untranslatable . '/translations');
}

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