You are here

protected function SearchCommentTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 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 62

Class

SearchCommentTest
Tests integration searching comments.

Namespace

Drupal\Tests\search\Functional

Code

protected function setUp() {
  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');
}