function CommentStatusFieldAccessTest::testCommentStatusFieldAccessStatus

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

Tests comment status field access.

File

core/modules/comment/tests/src/Functional/CommentStatusFieldAccessTest.php, line 88

Class

CommentStatusFieldAccessTest
Tests comment status field access.

Namespace

Drupal\Tests\comment\Functional

Code

public function testCommentStatusFieldAccessStatus() : void {
    $this->drupalLogin($this->nodeAuthor);
    $this->drupalGet('node/add/article');
    $assert = $this->assertSession();
    $assert->fieldNotExists('comment[0][status]');
    $this->submitForm([
        'title[0][value]' => 'Node 1',
    ], 'Save');
    $assert->fieldExists('subject[0][value]');
    $this->drupalLogin($this->commentAdmin);
    $this->drupalGet('node/add/article');
    $assert->fieldExists('comment[0][status]');
    $this->submitForm([
        'title[0][value]' => 'Node 2',
    ], 'Save');
    $assert->fieldExists('subject[0][value]');
}

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