Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. $payment->setPaymentReminderSendStatus(true)->save();
  2.  
  3. $this->orderPaymentMockSend->expects($this->once())
  4. ->method('setPaymentReminderSendStatus')
  5. ->with($paymentReminderSentStatus)
  6. ->willReturnSelf()
  7. ;
  8.  
  9. $this->orderPaymentMockSend = $this->getMockBuilder(Payment::class)
  10. ->disableOriginalConstructor()
  11. ->setMethods(['setPaymentReminderSendStatus'])
  12. ->getMock()
  13. ;
  14.  
  15. /** Mock Customer */
  16. //Add a magic method to the list of mocked class methods
  17. $methods = array_merge(
  18. get_class_methods(Customer::class),
  19. ['getCustomerType']
  20. );
  21.  
  22. $this->customerModelMock = $this->getMockBuilder(Customer::class)
  23. ->setMethods($methods)
  24. ->disableOriginalConstructor()
  25. ->getMock();
  26.  
  27. //Now I can mock my magic method !
  28. $this->customerModelMock->expects(static::any())
  29. ->method('getCustomerType')
  30. ->willReturn('professional');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement