protected function ContentEntityDatasourceTest::assertCorrectItems in Search API 8
Asserts that the given array of loaded items is correct.
Parameters
string[] $expected_ids: The expected item IDs, sorted.
\Drupal\Core\TypedData\ComplexDataInterface[] $loaded_items: The loaded items.
1 call to ContentEntityDatasourceTest::assertCorrectItems()
- ContentEntityDatasourceTest::testEntityLoading in tests/
src/ Kernel/ Datasource/ ContentEntityDatasourceTest.php - Tests entity loading.
File
- tests/
src/ Kernel/ Datasource/ ContentEntityDatasourceTest.php, line 157
Class
- ContentEntityDatasourceTest
- Tests correct functionality of the content entity datasource.
Namespace
Drupal\Tests\search_api\Kernel\DatasourceCode
protected function assertCorrectItems(array $expected_ids, array $loaded_items) {
$loaded_ids = array_keys($loaded_items);
sort($loaded_ids);
$this
->assertEquals($expected_ids, $loaded_ids);
foreach ($loaded_items as $item_id => $item) {
$this
->assertInstanceOf(EntityAdapter::class, $item);
$entity = $item
->getValue();
$this
->assertInstanceOf(EntityTestMulRevChanged::class, $entity);
list($id, $langcode) = explode(':', $item_id);
$this
->assertEquals($id, $entity
->id());
$this
->assertEquals($langcode, $entity
->language()
->getId());
}
}