public function SearchApiBrowserTestBase::getTestIndex in Search API 8
Creates or loads an index.
Return value
\Drupal\search_api\IndexInterface A search index.
5 calls to SearchApiBrowserTestBase::getTestIndex()
- EventsTest::setUp in tests/
src/ Functional/ EventsTest.php - HooksTest::setUp in tests/
src/ Functional/ HooksTest.php - LanguageIntegrationTest::setUp in tests/
src/ Functional/ LanguageIntegrationTest.php - OverviewPageTest::checkServerAndIndexCreation in tests/
src/ Functional/ OverviewPageTest.php - Tests the creation of a server and an index.
- OverviewPageTest::checkServerAndIndexStatusChanges in tests/
src/ Functional/ OverviewPageTest.php - Tests enable/disable operations for servers and indexes through the UI.
File
- tests/
src/ Functional/ SearchApiBrowserTestBase.php, line 167
Class
- SearchApiBrowserTestBase
- Provides the base class for web tests for Search API.
Namespace
Drupal\Tests\search_api\FunctionalCode
public function getTestIndex() {
$this->indexId = 'webtest_index';
$index = Index::load($this->indexId);
if (!$index) {
$index = Index::create([
'id' => $this->indexId,
'name' => 'WebTest index',
'description' => 'WebTest index description',
'server' => 'webtest_server',
'datasource_settings' => [
'entity:node' => [],
],
]);
$index
->save();
}
return $index;
}