protected function ViewsBulkOperationsKernelTestBase::getResultsList in Views Bulk Operations (VBO) 8.3
Same name and namespace in other branches
- 8.2 tests/src/Kernel/ViewsBulkOperationsKernelTestBase.php \Drupal\Tests\views_bulk_operations\Kernel\ViewsBulkOperationsKernelTestBase::getResultsList()
- 4.0.x tests/src/Kernel/ViewsBulkOperationsKernelTestBase.php \Drupal\Tests\views_bulk_operations\Kernel\ViewsBulkOperationsKernelTestBase::getResultsList()
Get a random list of results bulk keys.
Parameters
array $vbo_data: An array of data passed to VBO Processor service.
array $deltas: Array of result rows deltas.
Return value
array List of results to process.
2 calls to ViewsBulkOperationsKernelTestBase::getResultsList()
- ViewsBulkOperationsActionProcessorTest::testViewsbulkOperationsActionProcessor in tests/
src/ Kernel/ ViewsBulkOperationsActionProcessorTest.php - Tests general functionality of ViewsBulkOperationsActionProcessor.
- ViewsBulkOperationsActionProcessorTest::testViewsbulkOperationsActionProcessorExclude in tests/
src/ Kernel/ ViewsBulkOperationsActionProcessorTest.php - Tests exclude mode of ViewsBulkOperationsActionProcessor.
File
- tests/
src/ Kernel/ ViewsBulkOperationsKernelTestBase.php, line 203
Class
- ViewsBulkOperationsKernelTestBase
- Base class for Views Bulk Operations kernel tests.
Namespace
Drupal\Tests\views_bulk_operations\KernelCode
protected function getResultsList(array $vbo_data, array $deltas) {
// Merge in defaults.
$vbo_data += static::VBO_DEFAULTS;
$view = $this
->initializeView($vbo_data);
if (!empty($vbo_data['arguments'])) {
$view
->setArguments($vbo_data['arguments']);
}
if (!empty($vbo_data['exposed_input'])) {
$view
->setExposedInput($vbo_data['exposed_input']);
}
$view
->setItemsPerPage(0);
$view
->setCurrentPage(0);
$view
->execute();
$this->vboDataService
->init($view, $view
->getDisplay(), $vbo_data['relationship_id']);
$list = [];
$base_field = $view->storage
->get('base_field');
foreach ($deltas as $delta) {
$entity = $this->vboDataService
->getEntity($view->result[$delta]);
$list[] = [
$view->result[$delta]->{$base_field},
$entity
->language()
->getId(),
$entity
->getEntityTypeId(),
$entity
->id(),
];
}
$view
->destroy();
return $list;
}