WechatPayBuilderTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. declare(strict_types=1);
  3. namespace SixShop\WechatPay;
  4. use PHPUnit\Framework\TestCase;
  5. use SixShop\WechatPay\Trait\ApiTrait;
  6. use SixShop\WechatPay\Trait\MiniAppTrait;
  7. use WeChatPay\BuilderChainable;
  8. class WechatPayBuilderTest extends TestCase
  9. {
  10. use MiniAppTrait;
  11. use ApiTrait;
  12. public function testCreate()
  13. {
  14. $result = \SixShop\WechatPay\Facade\WechatPayBuilder::getBuilderChainable();
  15. $this->assertInstanceOf(BuilderChainable::class, $result);
  16. }
  17. public function testOpSpecialOrder()
  18. {
  19. $this->expectException(\InvalidArgumentException::class);
  20. $this->expectExceptionCode(268546002);
  21. $result = $this->opSpecialOrder('errororderid', 2);
  22. }
  23. public function testDomesticRefunds()
  24. {
  25. $result = $this->domesticRefunds('20250904133148020905', '20250904133148020905', 0.01);
  26. $this->assertObjectHasProperty('amount', $result);
  27. dump($result);
  28. }
  29. public function testQueryByOutTradeNo()
  30. {
  31. $result = $this->queryByOutTradeNo('20250904133148020905');
  32. dump($result);
  33. }
  34. public function testQueryRefund()
  35. {
  36. $result = $this->queryRefund('20250909135117037302');
  37. dump($result);
  38. }
  39. public function testQueryTransferBill()
  40. {
  41. $result = $this->queryTransferBill('20251105151948049869');
  42. dump($result);
  43. }
  44. }