protected function FunctionalTestBase::setupSearchApi in Search API Pages 8
Set up Search API database and server.
5 calls to FunctionalTestBase::setupSearchApi()
- BlockTest::setUp in tests/
src/ Functional/ BlockTest.php - FacetsIntegrationTest::setUp in tests/
src/ Functional/ FacetsIntegrationTest.php - IntegrationTest::testSearchApiPage in tests/
src/ Functional/ IntegrationTest.php - Tests Search API Pages.
- ParseModeTest::setUp in tests/
src/ Functional/ ParseModeTest.php - ViewModeTest::testDefaultViewModeAndOverrides in tests/
src/ Functional/ ViewModeTest.php - Tests whether the default view mode and the overrides can be used for a Search API Page.
File
- tests/
src/ Functional/ FunctionalTestBase.php, line 118
Class
- FunctionalTestBase
- Class FunctionalTestBase.
Namespace
Drupal\Tests\search_api_page\FunctionalCode
protected function setupSearchApi() {
$this->server = Server::create([
'name' => 'Server',
'id' => 'server_1',
'backend' => 'search_api_db',
'backend_config' => [
'database' => 'default:default',
],
]);
$this->server
->save();
$this->index = Index::create([
'id' => 'Index',
'name' => 'index_1',
'description' => 'Description for the index.',
'server' => $this->server
->id(),
'datasource_settings' => [
'entity:node' => [
'plugin_id' => 'entity:node',
'settings' => [],
],
],
'field_settings' => [
'rendered_item' => [
'label' => 'Rendered HTML output',
'property_path' => 'rendered_item',
'type' => 'text',
'configuration' => [
'roles' => [
'anonymous' => 'anonymous',
],
'view_mode' => [
'entity:node' => [
'article' => 'default',
'page' => '',
'blog' => 'default',
'document' => 'teaser',
],
],
],
],
],
]);
$this->index
->save();
$task_manager = \Drupal::getContainer()
->get('search_api.index_task_manager');
$task_manager
->addItemsAll(Index::load($this->index
->id()));
$this
->indexItems($this->index
->id());
}