You are here

public function CommentStatusFieldAccessTest::testCommentStatusFieldAccessStatus in Drupal 8

Same name and namespace in other branches
  1. 9 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',
  ], t('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',
  ], t('Save'));
  $assert
    ->fieldExists('subject[0][value]');
}