4

I am preparing phpunit tests. I need to create an order using mocking and that order i need to pass in my function.

Please suggest, How can i achieve this ?

1 Answer 1

0
 $orderMock = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
        $orderMock->expects($this->once())->method('getState')->willReturn('pending');

        return $orderMock;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.