function CommentOperationsTest::testCommentOperations
Same name in other branches
- 8.9.x core/modules/comment/tests/src/Functional/Views/CommentOperationsTest.php \Drupal\Tests\comment\Functional\Views\CommentOperationsTest::testCommentOperations()
- 10 core/modules/comment/tests/src/Functional/Views/CommentOperationsTest.php \Drupal\Tests\comment\Functional\Views\CommentOperationsTest::testCommentOperations()
- 11.x core/modules/comment/tests/src/Functional/Views/CommentOperationsTest.php \Drupal\Tests\comment\Functional\Views\CommentOperationsTest::testCommentOperations()
Tests 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\ViewsCode
public function testCommentOperations() {
$admin_account = $this->drupalCreateUser([
'administer comments',
]);
$this->drupalLogin($admin_account);
$this->drupalGet('test-comment-operations');
$this->assertSession()
->statusCodeEquals(200);
// Assert Edit operation is present.
$this->assertSession()
->elementsCount('xpath', '//td[contains(@class, "views-field-operations")]//li/a[text() = "Edit"]', 1);
// Assert Delete operation is present.
$this->assertSession()
->elementsCount('xpath', '//td[contains(@class, "views-field-operations")]//li/a[text() = "Delete"]', 1);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.