Skip to content

Commit 6edf123

Browse files
committed
Fix Bulk Batch processor
1 parent 0ed6423 commit 6edf123

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/Bulk.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function runBatch($operation, $objectType, $data, $options = [])
9393
if (in_array($batch->state, ['Completed', 'Failed', 'Not Processed', 'NotProcessed'])) {
9494
if (in_array($batch->state, ['Completed'])) {
9595
$batchResult = $this->batchResult($job->id, $batch->id, $options['isBatchedResult'], null, $options['contentType']);
96-
if($options['batchProcessor'] instanceof BulkBatchProcessorInterface){
96+
if(class_exists($options['batchProcessor']) && class_implements($options['batchProcessor'], '\Frankkessler\Salesforce\Interfaces\BulkBatchProcessorInterface')){
9797
call_user_func([$options['batchProcessor'], 'process'], $batchResult);
9898
}else {
9999
$batch->records = $batchResult->records;

tests/BulkBatchProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ class BulkBatchProcessor implements BulkBatchProcessorInterface
99

1010
public static function process(BulkBatchResultResponse $batchResult)
1111
{
12-
array_merge(static::$records, $batchResult->records);
12+
static::$records = array_merge(static::$records, $batchResult->records);
1313
}
1414
}

tests/BulkTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ public function testRunPkChunkQueryBatchWithBatchProcessor()
293293
'batchProcessor' => BulkBatchProcessor::class,
294294
]);
295295

296+
$this->assertEquals(2, count(BulkBatchProcessor::$records));
297+
296298
foreach(BulkBatchProcessor::$records as $record){
297299
$this->assertEquals($firstAccountId, $record['Id']);
298300
break;

0 commit comments

Comments
 (0)