One of the error you will encounter was
"Expectation failed for method name is equal to <string:create> when invoked zero or more times" this happen you call create method multiple times.
Sample:
/** @var \Winz\Sales\Api\Data\OrderInvoiceResultInterface */
$orderInvoiceResultInterface = $this->getMockBuilder('Winz\Sales\Api\Data\OrderInvoiceResultInterface')
->disableOriginalConstructor()
->setMethods(['setOrder', 'setInvoice', 'getOrder', 'getInvoice', ])
->getMock();
$orderInvoiceResult = $objectManagerInterface
->expects($this->any())
->method('create')
->with('Storm\Sales\Api\Data\OrderInvoiceResultInterface')
->willReturn($orderInvoiceResultInterface);
/** @var \Winz\Sales\Api\Data\OrderResultInterface */
$orderResultInterface = $this->getMockBuilder('Winz\Sales\Api\Data\OrderResultInterface')
->disableOriginalConstructor()
->setMethods(['setId', 'setNo', 'getId', 'getNo'])
->getMock();
$orderResult = $objectManagerInterface
->expects($this->once())
->method('create')
->with('Winz\Sales\Api\Data\OrderResultInterface')
->willReturn($orderResultInterface);
Fixed of the above code.
$orderResultInterface = $this->getMockBuilder('Storm\Sales\Api\Data\OrderResultInterface')
->disableOriginalConstructor()
->getMock();
$orderInvoiceResultInterface = $this->getMockBuilder('Winz\Sales\Api\Data\OrderInvoiceResultInterface')
->disableOriginalConstructor()
->setMethods(['setOrder', 'setInvoice', 'getOrder', 'getInvoice', ])
->getMock();
$objectManagerInterface
->expects($this->any())
->method('create')
->withConsecutive(
['Storm\Sales\Api\Data\OrderResultInterface'],
['Storm\Sales\Api\Data\OrderInvoiceResultInterface']
)
->willReturnOnConsecutiveCalls(
$this->returnValue($orderResultInterface),
$this->returnValue($orderInvoiceResultInterface)
);