You are here

public function SearchApiBrowserTestBase::setUp in Search API 8

Overrides BrowserTestBase::setUp

10 calls to SearchApiBrowserTestBase::setUp()
CacheabilityTest::setUp in tests/src/Functional/CacheabilityTest.php
ConfigOverrideIntegrationTest::setUp in tests/src/Functional/ConfigOverrideIntegrationTest.php
EventsTest::setUp in tests/src/Functional/EventsTest.php
ExcerptFieldTest::setUp in tests/src/Functional/ExcerptFieldTest.php
HooksTest::setUp in tests/src/Functional/HooksTest.php

... See full list

10 methods override SearchApiBrowserTestBase::setUp()
CacheabilityTest::setUp in tests/src/Functional/CacheabilityTest.php
ConfigOverrideIntegrationTest::setUp in tests/src/Functional/ConfigOverrideIntegrationTest.php
EventsTest::setUp in tests/src/Functional/EventsTest.php
ExcerptFieldTest::setUp in tests/src/Functional/ExcerptFieldTest.php
HooksTest::setUp in tests/src/Functional/HooksTest.php

... See full list

File

tests/src/Functional/SearchApiBrowserTestBase.php, line 104

Class

SearchApiBrowserTestBase
Provides the base class for web tests for Search API.

Namespace

Drupal\Tests\search_api\Functional

Code

public function setUp() {
  parent::setUp();

  // Create the users used for the tests.
  $this->adminUser = $this
    ->drupalCreateUser($this->adminUserPermissions);
  $this->unauthorizedUser = $this
    ->drupalCreateUser([
    'access administration pages',
  ]);
  $this->anonymousUser = $this
    ->drupalCreateUser();

  // Get the URL generator.
  $this->urlGenerator = \Drupal::getContainer()
    ->get('url_generator');

  // Create an article node type, if not already present.
  if (!NodeType::load('article')) {
    $this
      ->drupalCreateContentType([
      'type' => 'article',
      'name' => 'Article',
    ]);
  }

  // Create a page node type, if not already present.
  if (!NodeType::load('page')) {
    $this
      ->drupalCreateContentType([
      'type' => 'page',
      'name' => 'Page',
    ]);
  }

  // Do not use a batch for tracking the initial items after creating an
  // index when running the tests via the GUI. Otherwise, it seems Drupal's
  // Batch API gets confused and the test fails.
  if (!Utility::isRunningInCli()) {
    \Drupal::state()
      ->set('search_api_use_tracking_batch', FALSE);
  }
}