You are here

protected function SearchEmbedFormTest::setUp in Drupal 9

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

Overrides BrowserTestBase::setUp

File

core/modules/search/tests/src/Functional/SearchEmbedFormTest.php, line 38

Class

SearchEmbedFormTest
Verifies that a form embedded in search results works.

Namespace

Drupal\Tests\search\Functional

Code

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

  // Create a user and a node, and update the search index.
  $test_user = $this
    ->drupalCreateUser([
    'access content',
    'search content',
    'administer nodes',
  ]);
  $this
    ->drupalLogin($test_user);
  $this->node = $this
    ->drupalCreateNode();
  $this->container
    ->get('plugin.manager.search')
    ->createInstance('node_search')
    ->updateIndex();

  // Set up a dummy initial count of times the form has been submitted.
  $this->submitCount = \Drupal::state()
    ->get('search_embedded_form.submit_count');
  $this
    ->refreshVariables();
}