@@ -133,7 +133,7 @@ public function testExecute()
133
133
->with ($ stepExecution );
134
134
$ processor ->expects ($ this ->exactly (7 ))
135
135
->method ('process ' )
136
- ->will ($ this ->onConsecutiveCalls (1 , null , 3 , 4 , 5 , 6 , 7 , null ));
136
+ ->will ($ this ->onConsecutiveCalls (1 , 2 , 3 , 4 , 5 , 6 , 7 ));
137
137
138
138
$ writer = $ this ->getMockBuilder ('Oro \\Bundle \\BatchBundle \\Tests \\Unit \\Step \\Stub \\WriterStub ' )
139
139
->setMethods (array ('setStepExecution ' , 'write ' ))
@@ -299,6 +299,47 @@ public function testDispatchWriteInvalidItemException()
299
299
$ this ->itemStep ->execute ($ stepExecution );
300
300
}
301
301
302
+ public function testProcessShouldNotReturnNull ()
303
+ {
304
+ $ stepExecution = $ this ->getMockBuilder ('Oro \\Bundle \\BatchBundle \\Entity \\StepExecution ' )
305
+ ->disableOriginalConstructor ()
306
+ ->getMock ();
307
+ $ stepExecution ->expects ($ this ->any ())
308
+ ->method ('getStatus ' )
309
+ ->will ($ this ->returnValue (new BatchStatus (BatchStatus::STARTING )));
310
+
311
+ $ stepExecution ->expects ($ this ->once ())
312
+ ->method ('addFailureException ' );
313
+
314
+
315
+ $ this ->eventDispatcher
316
+ ->expects ($ this ->at (1 ))
317
+ ->method ('dispatch ' )
318
+ ->with (
319
+ EventInterface::STEP_EXECUTION_ERRORED ,
320
+ $ this ->anything ()
321
+ );
322
+
323
+
324
+ $ reader = $ this ->getMock ('Oro \\Bundle \\BatchBundle \\Item \\ItemReaderInterface ' );
325
+ $ reader ->expects ($ this ->any ())
326
+ ->method ('read ' )
327
+ ->will ($ this ->returnValue (array ('foo ' => 'bar ' )));
328
+
329
+ $ processor = $ this ->getMock ('Oro \\Bundle \\BatchBundle \\Item \\ItemProcessorInterface ' );
330
+ $ processor ->expects ($ this ->any ())
331
+ ->method ('process ' )
332
+ ->will ($ this ->returnValue (null ));
333
+
334
+ $ writer = $ this ->getMock ('Oro \\Bundle \\BatchBundle \\Item \\ItemWriterInterface ' );
335
+
336
+ $ this ->itemStep ->setReader ($ reader );
337
+ $ this ->itemStep ->setProcessor ($ processor );
338
+ $ this ->itemStep ->setWriter ($ writer );
339
+
340
+ $ this ->itemStep ->execute ($ stepExecution );
341
+ }
342
+
302
343
/**
303
344
* Assert the entity tested
304
345
*
0 commit comments