Chris@0: 'article', Chris@0: 'name' => t('Article'), Chris@0: ]); Chris@0: $node_type->save(); Chris@0: $this->nodeAuthor = $this->drupalCreateUser([ Chris@0: 'create article content', Chris@0: 'skip comment approval', Chris@0: 'post comments', Chris@0: 'edit own comments', Chris@0: 'access comments', Chris@0: 'administer nodes', Chris@0: ]); Chris@0: $this->commentAdmin = $this->drupalCreateUser([ Chris@0: 'administer comments', Chris@0: 'create article content', Chris@0: 'edit own comments', Chris@0: 'skip comment approval', Chris@0: 'post comments', Chris@0: 'access comments', Chris@0: 'administer nodes', Chris@0: ]); Chris@0: $this->addDefaultCommentField('node', 'article'); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Tests comment status field access. Chris@0: */ Chris@0: public function testCommentStatusFieldAccessStatus() { Chris@0: $this->drupalLogin($this->nodeAuthor); Chris@0: $this->drupalGet('node/add/article'); Chris@0: $assert = $this->assertSession(); Chris@0: $assert->fieldNotExists('comment[0][status]'); Chris@0: $this->submitForm([ Chris@0: 'title[0][value]' => 'Node 1', Chris@0: ], t('Save')); Chris@0: $assert->fieldExists('subject[0][value]'); Chris@0: $this->drupalLogin($this->commentAdmin); Chris@0: $this->drupalGet('node/add/article'); Chris@0: $assert->fieldExists('comment[0][status]'); Chris@0: $this->submitForm([ Chris@0: 'title[0][value]' => 'Node 2', Chris@0: ], t('Save')); Chris@0: $assert->fieldExists('subject[0][value]'); Chris@0: } Chris@0: Chris@0: }