public function ViewsBulkOperationsBatchTest::getViewsBulkOperationsActionProcessorStub in Views Bulk Operations (VBO) 8
Same name and namespace in other branches
- 8.3 tests/src/Unit/ViewsBulkOperationsBatchTest.php \Drupal\Tests\views_bulk_operations\Unit\ViewsBulkOperationsBatchTest::getViewsBulkOperationsActionProcessorStub()
- 8.2 tests/src/Unit/ViewsBulkOperationsBatchTest.php \Drupal\Tests\views_bulk_operations\Unit\ViewsBulkOperationsBatchTest::getViewsBulkOperationsActionProcessorStub()
- 4.0.x tests/src/Unit/ViewsBulkOperationsBatchTest.php \Drupal\Tests\views_bulk_operations\Unit\ViewsBulkOperationsBatchTest::getViewsBulkOperationsActionProcessorStub()
Returns a stub ViewsBulkOperationsActionProcessor that returns dummy data.
Return value
\Drupal\views_bulk_operations\Service\ViewsBulkOperationsActionProcessor A mocked action processor.
1 call to ViewsBulkOperationsBatchTest::getViewsBulkOperationsActionProcessorStub()
- ViewsBulkOperationsBatchTest::testOperation in tests/
src/ Unit/ ViewsBulkOperationsBatchTest.php - Tests the operation() method.
File
- tests/
src/ Unit/ ViewsBulkOperationsBatchTest.php, line 38
Class
- ViewsBulkOperationsBatchTest
- @coversDefaultClass \Drupal\views_bulk_operations\ViewsBulkOperationsBatch @group views_bulk_operations
Namespace
Drupal\Tests\views_bulk_operations\UnitCode
public function getViewsBulkOperationsActionProcessorStub($entities_count) {
$actionProcessor = $this
->getMockBuilder('Drupal\\views_bulk_operations\\Service\\ViewsBulkOperationsActionProcessor')
->disableOriginalConstructor()
->getMock();
$actionProcessor
->expects($this
->any())
->method('getEntity')
->will($this
->returnValue(new \stdClass()));
$actionProcessor
->expects($this
->any())
->method('populateQueue')
->will($this
->returnValue($entities_count));
$actionProcessor
->expects($this
->any())
->method('process')
->will($this
->returnCallback(function () use ($entities_count) {
$return = [];
for ($i = 0; $i < $entities_count; $i++) {
$return[] = 'Some action';
}
return $return;
}));
return $actionProcessor;
}