You are here

protected function SearchAdvancedSearchFormTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/search/tests/src/Functional/SearchAdvancedSearchFormTest.php \Drupal\Tests\search\Functional\SearchAdvancedSearchFormTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/search/tests/src/Functional/SearchAdvancedSearchFormTest.php, line 31

Class

SearchAdvancedSearchFormTest
Indexes content and tests the advanced search form.

Namespace

Drupal\Tests\search\Functional

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);
  $this
    ->drupalCreateContentType([
    'type' => 'article',
    'name' => 'Article',
  ]);

  // Create and log in user.
  $test_user = $this
    ->drupalCreateUser([
    'access content',
    'search content',
    'use advanced search',
    'administer nodes',
  ]);
  $this
    ->drupalLogin($test_user);

  // Create initial node.
  $this->node = $this
    ->drupalCreateNode();

  // First update the index. This does the initial processing.
  $this->container
    ->get('plugin.manager.search')
    ->createInstance('node_search')
    ->updateIndex();
}