protected function DependencyRemovalTest::setUp in Search API Autocomplete 8
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ DependencyRemovalTest.php, line 53
Class
- DependencyRemovalTest
- Tests dependency handling of the search entity.
Namespace
Drupal\Tests\search_api_autocomplete\KernelCode
protected function setUp() {
parent::setUp();
// 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 (php_sapi_name() != 'cli') {
\Drupal::state()
->set('search_api_use_tracking_batch', FALSE);
}
$this
->installEntitySchema('entity_test_mulrev_changed');
$this
->installEntitySchema('search_api_task');
$this
->installEntitySchema('user');
$this
->installSchema('search_api', [
'search_api_item',
]);
$this
->installSchema('system', [
'key_value_expire',
]);
$this
->installConfig('search_api');
$this
->installConfig('search_api_autocomplete_test');
// Create our test search, but don't save it yet so individual tests can
// still easily change the settings.
$this->search = Search::create([
'id' => 'search_api_autocomplete_test_view',
'label' => 'Test',
'status' => TRUE,
'index_id' => 'autocomplete_search_index',
'suggester_settings' => [
'search_api_autocomplete_test' => [],
],
'search_settings' => [
'views:search_api_autocomplete_test_view' => [],
],
]);
// Use a search server as the dependency, since we have that available
// anyways. The entity type should not matter at all, though.
$this->dependency = Server::create([
'id' => 'dependency',
'name' => 'Test dependency',
'backend' => 'search_api_test',
]);
$this->dependency
->save();
}