function CommentAccessTest::setUp
Same name in other branches
- 9 core/modules/comment/tests/src/Functional/CommentAccessTest.php \Drupal\Tests\comment\Functional\CommentAccessTest::setUp()
- 8.9.x core/modules/comment/tests/src/Functional/CommentAccessTest.php \Drupal\Tests\comment\Functional\CommentAccessTest::setUp()
- 11.x core/modules/comment/tests/src/Functional/CommentAccessTest.php \Drupal\Tests\comment\Functional\CommentAccessTest::setUp()
Overrides BrowserTestBase::setUp
File
-
core/
modules/ comment/ tests/ src/ Functional/ CommentAccessTest.php, line 44
Class
- CommentAccessTest
- Tests comment administration and preview access.
Namespace
Drupal\Tests\comment\FunctionalCode
protected function setUp() : void {
parent::setUp();
$node_type = NodeType::create([
'type' => 'article',
'name' => 'Article',
]);
$node_type->save();
$node_author = $this->drupalCreateUser([
'create article content',
'access comments',
]);
$this->drupalLogin($this->drupalCreateUser([
'edit own comments',
'skip comment approval',
'post comments',
'access comments',
'access content',
]));
$this->addDefaultCommentField('node', 'article');
$this->unpublishedNode = $this->createNode([
'title' => 'This is unpublished',
'uid' => $node_author->id(),
'status' => 0,
'type' => 'article',
]);
$this->unpublishedNode
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.