You are here

protected function SearchCommentTest::setUp in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/search/src/Tests/SearchCommentTest.php \Drupal\search\Tests\SearchCommentTest::setUp()

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides SearchTestBase::setUp

File

core/modules/search/src/Tests/SearchCommentTest.php, line 59
Contains \Drupal\search\Tests\SearchCommentTest.

Class

SearchCommentTest
Tests integration searching comments.

Namespace

Drupal\search\Tests

Code

protected function setUp() {
  parent::setUp();
  $full_html_format = entity_create('filter_format', array(
    'format' => 'full_html',
    'name' => 'Full HTML',
    'weight' => 1,
    'filters' => array(),
  ));
  $full_html_format
    ->save();

  // Create and log in an administrative user having access to the Full HTML
  // text format.
  $permissions = array(
    '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');
}