You are here

protected function IndexResourceTest::setUp in JSON:API Search API 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/IndexResourceTest.php, line 44

Class

IndexResourceTest
Tests index resource..

Namespace

Drupal\Tests\jsonapi_search_api\Functional

Code

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

  // Set up example structure and content and populate the test index with
  // that content.
  $this
    ->setUpExampleStructure();
  $this
    ->insertExampleContent();
  $index = Index::load('database_search_index');
  assert($index instanceof IndexInterface);
  $this->container
    ->get('search_api.index_task_manager')
    ->addItemsAll($index);
  $index
    ->indexItems();
  $this->container
    ->get('router.builder')
    ->rebuildIfNeeded();
  $this
    ->grantPermissions(Role::load(Role::ANONYMOUS_ID), [
    'view test entity',
  ]);
}