function SearchEmbedFormTest::setUp

Same name in other branches
  1. 9 core/modules/search/tests/src/Functional/SearchEmbedFormTest.php \Drupal\Tests\search\Functional\SearchEmbedFormTest::setUp()
  2. 8.9.x core/modules/search/tests/src/Functional/SearchEmbedFormTest.php \Drupal\Tests\search\Functional\SearchEmbedFormTest::setUp()
  3. 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 43

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();
}

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