CommentEditTest.php in Drupal 9        
                          
                  
                        
  
  
  
  
File
  core/modules/comment/tests/src/Functional/Views/CommentEditTest.php
  
    View source  
  <?php
namespace Drupal\Tests\comment\Functional\Views;
use Drupal\Tests\comment\Functional\CommentTestBase as CommentBrowserTestBase;
class CommentEditTest extends CommentBrowserTestBase {
  
  protected $profile = 'standard';
  
  public function testCommentEdit() {
    $this
      ->drupalLogin($this->adminUser);
    
    $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());
  }
}