You are here

protected function BackendTestBase::checkIndexWithoutFields in Search API 8

Checks the correct handling of an index without fields.

Return value

\Drupal\search_api\IndexInterface The created test index.

2 calls to BackendTestBase::checkIndexWithoutFields()
BackendTest::checkIndexWithoutFields in modules/search_api_db/tests/src/Kernel/BackendTest.php
Checks the correct handling of an index without fields.
BackendTestBase::testBackend in tests/src/Kernel/BackendTestBase.php
Tests various indexing scenarios for the search backend.
1 method overrides BackendTestBase::checkIndexWithoutFields()
BackendTest::checkIndexWithoutFields in modules/search_api_db/tests/src/Kernel/BackendTest.php
Checks the correct handling of an index without fields.

File

tests/src/Kernel/BackendTestBase.php, line 1073

Class

BackendTestBase
Provides a base class for backend tests.

Namespace

Drupal\Tests\search_api\Kernel

Code

protected function checkIndexWithoutFields() {
  $index = Index::create([
    'id' => 'test_index_2',
    'name' => 'Test index 2',
    'status' => TRUE,
    'server' => $this->serverId,
    'datasource_settings' => [
      'entity:entity_test_mulrev_changed' => [],
    ],
    'tracker_settings' => [
      'default' => [],
    ],
  ]);
  $index
    ->save();
  $indexed_count = $this
    ->indexItems($index
    ->id());
  $this
    ->assertEquals(count($this->entities), $indexed_count);
  $search_count = $index
    ->query()
    ->execute()
    ->getResultCount();
  $this
    ->assertEquals(count($this->entities), $search_count);
  return $index;
}