function SearchCommentTest::setUp

Same name in other branches
  1. 9 core/modules/search/tests/src/Functional/SearchCommentTest.php \Drupal\Tests\search\Functional\SearchCommentTest::setUp()
  2. 8.9.x core/modules/search/tests/src/Functional/SearchCommentTest.php \Drupal\Tests\search\Functional\SearchCommentTest::setUp()
  3. 11.x core/modules/search/tests/src/Functional/SearchCommentTest.php \Drupal\Tests\search\Functional\SearchCommentTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/search/tests/src/Functional/SearchCommentTest.php, line 67

Class

SearchCommentTest
Tests integration searching comments.

Namespace

Drupal\Tests\search\Functional

Code

protected function setUp() : void {
    parent::setUp();
    $this->drupalCreateContentType([
        'type' => 'page',
        'name' => 'Basic page',
    ]);
    $this->drupalCreateContentType([
        'type' => 'article',
        'name' => 'Article',
    ]);
    $full_html_format = FilterFormat::create([
        'format' => 'full_html',
        'name' => 'Full HTML',
        'weight' => 1,
        'filters' => [],
    ]);
    $full_html_format->save();
    // Create and log in an administrative user having access to the Full HTML
    // text format.
    $permissions = [
        'administer filters',
        $full_html_format->getPermissionName(),
        'administer permissions',
        'create page content',
        'post comments',
        'skip comment approval',
        'access comments',
    ];
    $this->adminUser = $this->drupalCreateUser($permissions);
    $this->drupalLogin($this->adminUser);
    // Add a comment field.
    $this->addDefaultCommentField('node', 'article');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.