ab_tanjir

Untitled

Aug 14th, 2023
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. public function testSetOrderChannel()
  2. {
  3. // Mock tbOrderBackendChannel and SimpleXMLElement
  4. $orderChannelMock = $this->createMock(tbOrderBackendChannel::class);
  5. $xmlMock = $this->createMock(SimpleXMLElement::class);
  6.  
  7. // Set expectations and assertions for the mocked objects
  8. $xmlMock->expects($this->once())
  9. ->method('__get')
  10. ->with($this->equalTo('IsPrime'))
  11. ->willReturn('true');
  12.  
  13. // Create an instance of tbAmazonSpOrdersService
  14. $configMock = $this->createMock(tbChannelConfig::class);
  15. $service = new tbAmazonSpOrdersService($configMock);
  16.  
  17. // Call the method to be tested
  18. $service->setOrderChannel($orderChannelMock, $xmlMock);
  19.  
  20. // Assert that the values are correctly set in the order channel
  21. $this->assertEquals('true', $orderChannelMock->getValueByKey('IsPrime'));
  22. }
Advertisement
Add Comment
Please, Sign In to add comment