You are here

public function DependencyRemovalTest::setUp in Search API 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/ConfigEntity/DependencyRemovalTest.php, line 53

Class

DependencyRemovalTest
Tests what happens when an index's or a server's dependencies are removed.

Namespace

Drupal\Tests\search_api\Kernel\ConfigEntity

Code

public function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('search_api_task');
  $this
    ->installConfig('search_api');

  // Create the index object, but don't save it yet since we want to change
  // its settings anyways in every test.
  $this->index = Index::create([
    'id' => 'test_index',
    'name' => 'Test index',
    'tracker_settings' => [
      'default' => [],
    ],
    'datasource_settings' => [
      'entity:user' => [],
    ],
  ]);

  // 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();
}