function CommentEditTest::testCommentEdit

Same name in other branches
  1. 9 core/modules/comment/tests/src/Functional/Views/CommentEditTest.php \Drupal\Tests\comment\Functional\Views\CommentEditTest::testCommentEdit()
  2. 8.9.x core/modules/comment/tests/src/Functional/Views/CommentEditTest.php \Drupal\Tests\comment\Functional\Views\CommentEditTest::testCommentEdit()
  3. 10 core/modules/comment/tests/src/Functional/Views/CommentEditTest.php \Drupal\Tests\comment\Functional\Views\CommentEditTest::testCommentEdit()

Tests comment label in admin view.

File

core/modules/comment/tests/src/Functional/Views/CommentEditTest.php, line 24

Class

CommentEditTest
Tests comment edit functionality.

Namespace

Drupal\Tests\comment\Functional\Views

Code

public function testCommentEdit() : void {
    $this->drupalLogin($this->adminUser);
    // Post a comment to node.
    $node_comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
    $this->drupalGet('admin/content/comment');
    $this->assertSession()
        ->pageTextContains($this->adminUser
        ->label());
    $this->drupalGet($node_comment->toUrl('edit-form'));
    $edit = [
        'comment_body[0][value]' => $this->randomMachineName(),
    ];
    $this->submitForm($edit, 'Save');
    $this->drupalGet('admin/content/comment');
    $this->assertSession()
        ->pageTextContains($this->adminUser
        ->label());
}

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