protected function ProcessorTestBase::generateItems in Search API 8
Generates some test items.
Parameters
array[] $items: Array of items to be transformed into proper search item objects. Each item in this array is an associative array with the following keys:
- datasource: The datasource plugin ID.
- item: The item object to be indexed.
- item_id: The datasource-specific raw item ID.
- *: Any other keys will be treated as property paths, and their values as a single value for a field with that property path.
Return value
\Drupal\search_api\Item\ItemInterface[] The generated test items.
5 calls to ProcessorTestBase::generateItems()
- ContentAccessTest::testContentAccessAll in tests/
src/ Kernel/ Processor/ ContentAccessTest.php - Tests comment indexing when all users have access to content.
- ContentAccessTest::testContentAccessWithNodeGrants in tests/
src/ Kernel/ Processor/ ContentAccessTest.php - Tests comment indexing when hook_node_grants() takes effect.
- RenderedItemTest::testAddFieldValues in tests/
src/ Kernel/ Processor/ RenderedItemTest.php - Tests whether the rendered_item field is correctly filled by the processor.
- RenderedItemTest::testHideRenderedItem in tests/
src/ Kernel/ Processor/ RenderedItemTest.php - Tests that hiding a rendered item works.
- TypeBoostTest::testEntityBundleBoost in tests/
src/ Kernel/ Processor/ TypeBoostTest.php - Tests that the correct boost is set on items.
File
- tests/
src/ Kernel/ Processor/ ProcessorTestBase.php, line 149
Class
- ProcessorTestBase
- Provides a base class for Drupal unit tests for processors.
Namespace
Drupal\Tests\search_api\Kernel\ProcessorCode
protected function generateItems(array $items) {
/** @var \Drupal\search_api\Item\ItemInterface[] $extracted_items */
$extracted_items = [];
foreach ($items as $values) {
$item = $this
->generateItem($values);
$extracted_items[$item
->getId()] = $item;
}
return $extracted_items;
}