protected function IndexFacetsTest::setUp in JSON:API Search API 8
Overrides BrowserTestBase::setUp
File
- modules/
jsonapi_search_api_facets/ tests/ src/ Functional/ IndexFacetsTest.php, line 48
Class
- IndexFacetsTest
- Tests searching with facets.
Namespace
Drupal\Tests\jsonapi_search_api_facets\FunctionalCode
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',
]);
FacetSource::create([
'id' => 'jsonapi_search_api_facets__database_search_index',
'name' => 'jsonapi_search_api_facets:database_search_index',
])
->save();
}