function CommentOperationsTest::testCommentOperations

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

Test the operations field plugin.

File

core/modules/comment/tests/src/Functional/Views/CommentOperationsTest.php, line 27

Class

CommentOperationsTest
Tests comment operations.

Namespace

Drupal\Tests\comment\Functional\Views

Code

public function testCommentOperations() {
  $admin_account = $this->drupalCreateUser([
    'administer comments',
  ]);
  $this->drupalLogin($admin_account);
  $this->drupalGet('test-comment-operations');
  $this->assertSession()
    ->statusCodeEquals(200);
  $operation = $this->cssSelect('.views-field-operations li.edit a');
  $this->assertCount(1, $operation, 'Found edit operation for comment.');
  $operation = $this->cssSelect('.views-field-operations li.delete a');
  $this->assertCount(1, $operation, 'Found delete operation for comment.');
}

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