You are here

public function ContentEntityDatasourceTest::testEntityLoading in Search API 8

Tests entity loading.

@covers ::loadMultiple

File

tests/src/Kernel/Datasource/ContentEntityDatasourceTest.php, line 118

Class

ContentEntityDatasourceTest
Tests correct functionality of the content entity datasource.

Namespace

Drupal\Tests\search_api\Kernel\Datasource

Code

public function testEntityLoading() {
  $loaded_items = $this->datasource
    ->loadMultiple($this->allItemIds);
  $this
    ->assertCorrectItems($this->allItemIds, $loaded_items);
  $this->datasource
    ->setConfiguration([
    'bundles' => [
      'default' => FALSE,
      'selected' => [
        'item',
      ],
    ],
    'languages' => [
      'default' => TRUE,
      'selected' => [
        'l0',
      ],
    ],
  ]);
  $loaded_items = $this->datasource
    ->loadMultiple($this->allItemIds);
  $this
    ->assertCorrectItems([
    '1:l1',
  ], $loaded_items);
  $this->datasource
    ->setConfiguration([
    'bundles' => [
      'default' => TRUE,
      'selected' => [
        'item',
      ],
    ],
    'languages' => [
      'default' => FALSE,
      'selected' => [
        'l0',
        'l1',
      ],
    ],
  ]);
  $loaded_items = $this->datasource
    ->loadMultiple($this->allItemIds);
  $this
    ->assertCorrectItems([
    '2:l0',
    '2:l1',
  ], $loaded_items);
}