wechatpay-apiv3 / wechatpay-go

微信支付 APIv3 的官方 Go Library
https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/index.shtml
Apache License 2.0
1.03k stars 141 forks source link

单测: 使用兼容性更好的xgo替换gomonkey #218

Closed xhd2015 closed 5 months ago

xhd2015 commented 5 months ago

在这个PR中,我使用xgo替换了gomonkey。 xgo相对于gomonkey具有如下优点:

xgo的项目地址: https://github.com/xhd2015/xgo

使用xgo进行单测的步骤:

  1. 安装
    
    # macOS and Linux (and WSL)
    curl -fsSL https://github.com/xhd2015/xgo/raw/master/install.sh | bash

windows

powershell -c "irm github.com/xhd2015/xgo/raw/master/install.ps1|iex"


2. 执行test
```sh
xgo test ./...

测试结果:

 xgo test ./...
xgo is taking a while to setup, please wait...
?       github.com/wechatpay-apiv3/wechatpay-go/cmd/wechatpay_download_certs    [no test files]
?       github.com/wechatpay-apiv3/wechatpay-go/core/auth       [no test files]
?       github.com/wechatpay-apiv3/wechatpay-go/core/cipher     [no test files]
ok      github.com/wechatpay-apiv3/wechatpay-go/core    0.928s
ok      github.com/wechatpay-apiv3/wechatpay-go/core/auth/credentials   1.249s
ok      github.com/wechatpay-apiv3/wechatpay-go/core/auth/signers       1.442s
?       github.com/wechatpay-apiv3/wechatpay-go/core/consts     [no test files]
ok      github.com/wechatpay-apiv3/wechatpay-go/core/auth/validators    1.692s
?       github.com/wechatpay-apiv3/wechatpay-go/core/option     [no test files]
?       github.com/wechatpay-apiv3/wechatpay-go/services        [no test files]
ok      github.com/wechatpay-apiv3/wechatpay-go/core/auth/verifiers     2.113s
ok      github.com/wechatpay-apiv3/wechatpay-go/core/cipher/ciphers     1.986s
ok      github.com/wechatpay-apiv3/wechatpay-go/core/cipher/decryptors  1.686s
ok      github.com/wechatpay-apiv3/wechatpay-go/core/cipher/encryptors  1.722s
?       github.com/wechatpay-apiv3/wechatpay-go/services/partnerpayments        [no test files]
?       github.com/wechatpay-apiv3/wechatpay-go/services/payments       [no test files]
ok      github.com/wechatpay-apiv3/wechatpay-go/core/downloader 12.718s
ok      github.com/wechatpay-apiv3/wechatpay-go/core/notify     1.926s
ok      github.com/wechatpay-apiv3/wechatpay-go/services/cashcoupons    2.426s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/certificates   3.012s
ok      github.com/wechatpay-apiv3/wechatpay-go/services/fileuploader   2.588s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/giftactivity   3.414s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/goldplan       3.594s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/lovefeast      3.796s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/merchantexclusivecoupon        3.298s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/partnerpayments/app    3.556s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/partnerpayments/h5     3.502s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/partnerpayments/jsapi  3.669s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/partnerpayments/native 3.704s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/partnertransferbatch   3.597s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/payments/app   3.425s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/payments/h5    3.589s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/payments/jsapi 3.499s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/payments/native        3.367s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/payrollcard    3.166s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/profitsharing  3.290s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/refunddomestic 3.332s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/retailstore    2.990s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/transferbatch  3.040s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/weixinpayscanandride   2.945s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/services/wexinpayscoreparking   2.921s [no tests to run]
ok      github.com/wechatpay-apiv3/wechatpay-go/utils   3.431s
ok      github.com/wechatpay-apiv3/wechatpay-go/utils/task      17.734s
sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

xy-peng commented 5 months ago

感谢自荐和贡献。综合各方面考虑,我们先保持观察,增加 xgo 的了解,等验证稳定和安全之后,再做决定。