ab_tanjir

Untitled

Aug 10th, 2023 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. public function testGetSellToAddressWithBillingAddress()
  2. {
  3. $xml = new SimpleXMLElement('<Order><BillingData><Address><City>City1</City></Address></BillingData><FulfillmentData><Address><City>City2</City></Address></FulfillmentData></Order>');
  4. $result = $this->xmlReader->getSellToAddress($xml);
  5. $this->assertInstanceOf(SimpleXMLElement::class, $result);
  6. $this->assertSame('City1', (string)$result->City);
  7. }
  8.  
  9. public function testGetSellToAddressWithFulfillmentAddress()
  10. {
  11. $xml = new SimpleXMLElement('<Order><BillingData><Address><City>City1</City></Address></BillingData><FulfillmentData><Address><City>City2</City></Address></FulfillmentData></Order>');
  12. $result = $this->xmlReader->getSellToAddress($xml);
  13. $this->assertInstanceOf(SimpleXMLElement::class, $result);
  14. $this->assertSame('City1', (string)$result->City);
  15. }
  16.  
  17. public function testGetSellToAddressWithDifferentAddresses()
  18. {
  19. $xml = new SimpleXMLElement('<Order><BillingData><Address><City>City1</City></Address></BillingData><FulfillmentData><Address><City>City2</City></Address></FulfillmentData></Order>');
  20. $result = $this->xmlReader->getSellToAddress($xml);
  21. $this->assertInstanceOf(SimpleXMLElement::class, $result);
  22. $this->assertSame('City1', (string)$result->City);
  23. }
  24.  
  25. public function testGetShipToAddressWithFulfillmentAddress()
  26. {
  27. $xml = new SimpleXMLElement('<Order><FulfillmentData><Address><City>City</City></Address></FulfillmentData></Order>');
  28. $result = $this->xmlReader->getShipToAddress($xml);
  29. $this->assertInstanceOf(SimpleXMLElement::class, $result);
  30. $this->assertSame('City', (string)$result->City);
  31. }
  32.  
  33. public function testGetShipToAddressWithoutFulfillmentAddress()
  34. {
  35. $xml = new SimpleXMLElement('<Order></Order>');
  36. $result = $this->xmlReader->getShipToAddress($xml);
  37. $this->assertNull($result);
  38. }
  39.  
  40. public function testGetStateOrRegionWithState()
  41. {
  42. $xml = new SimpleXMLElement('<Address><StateOrRegion>CA</StateOrRegion></Address>');
  43. $result = $this->xmlReader->getStateOrRegion($xml);
  44. $this->assertSame('CA', $result);
  45. }
  46.  
  47. public function testGetStateOrRegionWithoutState()
  48. {
  49. $xml = new SimpleXMLElement('<Address></Address>');
  50. $result = $this->xmlReader->getStateOrRegion($xml);
  51. $this->assertSame('', $result);
  52. }
  53.  
Advertisement
Add Comment
Please, Sign In to add comment