ApplePayConfigurationTest.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace CMText\RichContent\Payments;
  3. use PHPUnit\Framework\TestCase;
  4. class ApplePayConfigurationTest extends TestCase
  5. {
  6. public function test__construct()
  7. {
  8. $configuration = new ApplePayConfiguration(
  9. 'merchant-name',
  10. 'product-description',
  11. 'unique-order-guid',
  12. 1,
  13. 'currency-code',
  14. 'recipient-email',
  15. 'recipient-country-code',
  16. 'language-country-code',
  17. true,
  18. true,
  19. [
  20. new \CMText\RichContent\Common\LineItem(
  21. 'product-name',
  22. 'final-or-pending',
  23. 1
  24. )
  25. ]
  26. );
  27. $json = json_decode(json_encode($configuration));
  28. $this->assertObjectHasAttribute(
  29. 'merchantName',
  30. $json
  31. );
  32. $this->assertObjectHasAttribute(
  33. 'description',
  34. $json
  35. );
  36. $this->assertObjectHasAttribute(
  37. 'orderReference',
  38. $json
  39. );
  40. $this->assertObjectHasAttribute(
  41. 'total',
  42. $json
  43. );
  44. $this->assertObjectHasAttribute(
  45. 'currencyCode',
  46. $json
  47. );
  48. $this->assertObjectHasAttribute(
  49. 'recipientEmail',
  50. $json
  51. );
  52. $this->assertObjectHasAttribute(
  53. 'recipientCountryCode',
  54. $json
  55. );
  56. $this->assertObjectHasAttribute(
  57. 'languageCountryCode',
  58. $json
  59. );
  60. $this->assertObjectHasAttribute(
  61. 'billingAddressRequired',
  62. $json
  63. );
  64. $this->assertObjectHasAttribute(
  65. 'shippingContactRequired',
  66. $json
  67. );
  68. $this->assertObjectHasAttribute(
  69. 'lineItems',
  70. $json
  71. );
  72. }
  73. }