ClientTest.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace Alipay\EasySDK\Test\member\identification;
  3. use Alipay\EasySDK\Kernel\Factory;
  4. use Alipay\EasySDK\Member\Identification\Models\IdentityParam;
  5. use Alipay\EasySDK\Member\Identification\Models\MerchantConfig;
  6. use Alipay\EasySDK\Test\TestAccount;
  7. use PHPUnit\Framework\TestCase;
  8. class ClientTest extends TestCase
  9. {
  10. public function __construct($name = null, array $data = [], $dataName = '')
  11. {
  12. parent::__construct($name, $data, $dataName);
  13. $account = new TestAccount();
  14. Factory::setOptions($account->getTestAccount());
  15. }
  16. public function testInit()
  17. {
  18. $identityParam = new IdentityParam();
  19. $identityParam->identityType = "CERT_INFO";
  20. $identityParam->certType = "IDENTITY_CARD";
  21. $identityParam->certName = "张三";
  22. $identityParam->certNo = "5139011988090987631";
  23. $merchantConfig = new MerchantConfig();
  24. $merchantConfig->returnUrl = "www.taobao.com";
  25. $result = Factory::member()->identification()->init(microtime(),'FACE',$identityParam,$merchantConfig);
  26. $this->assertEquals('10000', $result->code);
  27. $this->assertEquals('Success', $result->msg);
  28. }
  29. public function testCertify()
  30. {
  31. $result = Factory::member()->identification()->certify("16cbbf40de9829e337d51818a76eacc2");
  32. $this->assertEquals(true, strpos($result->body,'sign')>0);
  33. $this->assertEquals(true, strpos($result->body,'gateway.do')>0);
  34. }
  35. public function testQuery()
  36. {
  37. $result = Factory::member()->identification()->query("16cbbf40de9829e337d51818a76eacc2");
  38. $this->assertEquals('40004', $result->code);
  39. $this->assertEquals('Business Failed', $result->msg);
  40. $this->assertEquals('CERTIFY_ID_EXPIRED',$result->subCode);
  41. $this->assertEquals('认证已失效',$result->subMsg);
  42. }
  43. }