You are here

public function CommentStatusFieldAccessTest::testCommentStatusFieldAccessStatus in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/comment/tests/src/Functional/CommentStatusFieldAccessTest.php \Drupal\Tests\comment\Functional\CommentStatusFieldAccessTest::testCommentStatusFieldAccessStatus()
  2. 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 86

Class

CommentStatusFieldAccessTest
Tests comment status field access.

Namespace

Drupal\Tests\comment\Functional

Code

public function testCommentStatusFieldAccessStatus() {
  $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]');
}