AccountTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. class AccountTest extends TestCase
  4. {
  5. // public function testOne()
  6. // {
  7. // $this->assertTrue(false);
  8. // }
  9. public function testPayment()
  10. {
  11. // 查询账户余额
  12. AdaPay\AdaPay::$gateWayType = 'page';
  13. $obj = new AdaPaySdk\Account();
  14. $account_params = array(
  15. # 商户的应用 id
  16. 'app_id'=> 'app_7d87c043-aae3-4357-9b2c-269349a980d6',
  17. # 用户ID
  18. 'order_no'=> "WL_". date("YmdHis").rand(100000, 999999),
  19. # 订单总金额(必须大于0)
  20. 'pay_amt'=> '0.10',
  21. # 3 位 ISO 货币代码,小写字母
  22. 'currency'=> 'cny',
  23. # 商品标题
  24. 'goods_title'=> '12314',
  25. # 商品描述信息
  26. 'goods_desc'=> '123122123',
  27. );
  28. $obj->payment($account_params);
  29. // var_dump($account->result);
  30. print($obj->isError().'=>'.json_encode($obj->result));
  31. $this->assertEquals('succeeded', $obj->result['status']);
  32. // $this->assertTrue($account->isError());
  33. }
  34. }