protected function CommentTestBase::setUp in Drupal 10
Same name in this branch
- 10 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setUp()
- 10 core/modules/comment/tests/src/Functional/Views/CommentTestBase.php \Drupal\Tests\comment\Functional\Views\CommentTestBase::setUp()
Same name and namespace in other branches
- 8 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setUp()
- 9 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setUp()
1 method overrides CommentTestBase::setUp()
- CommentAdminTest::setUp in core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php
File
- core/modules/comment/tests/src/Functional/CommentTestBase.php, line 57
Class
- CommentTestBase
- Provides setup and helper methods for comment tests.
Namespace
Drupal\Tests\comment\Functional
Code
protected function setUp() : void {
parent::setUp();
$types = NodeType::loadMultiple();
if (empty($types['article'])) {
$this
->drupalCreateContentType([
'type' => 'article',
'name' => t('Article'),
]);
}
$this->adminUser = $this
->drupalCreateUser([
'administer content types',
'administer comments',
'administer comment types',
'administer comment fields',
'administer comment display',
'skip comment approval',
'post comments',
'access comments',
'access user profiles',
'access content',
]);
$this->webUser = $this
->drupalCreateUser([
'access comments',
'post comments',
'create article content',
'edit own comments',
'skip comment approval',
'access content',
]);
$this
->addDefaultCommentField('node', 'article');
$this->node = $this
->drupalCreateNode([
'type' => 'article',
'promote' => 1,
'uid' => $this->webUser
->id(),
]);
$this
->drupalPlaceBlock('local_tasks_block');
}