LegacyWapGatewayTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace Omnipay\Alipay\Tests;
  3. use Omnipay\Alipay\Common\Signer;
  4. use Omnipay\Alipay\LegacyWapGateway;
  5. use Omnipay\Alipay\Requests\LegacyCompletePurchaseRequest;
  6. use Omnipay\Alipay\Responses\LegacyCompletePurchaseResponse;
  7. use Omnipay\Alipay\Responses\LegacyWapPurchaseResponse;
  8. class LegacyWapGatewayTest extends AbstractGatewayTestCase
  9. {
  10. /**
  11. * @var LegacyWapGateway $gateway
  12. */
  13. protected $gateway;
  14. protected $options;
  15. public function setUp()
  16. {
  17. parent::setUp();
  18. $this->gateway = new LegacyWapGateway($this->getHttpClient(), $this->getHttpRequest());
  19. $this->gateway->setPartner($this->partner);
  20. $this->gateway->setKey($this->key);
  21. $this->gateway->setSellerId($this->sellerId);
  22. $this->gateway->setNotifyUrl('https://www.example.com/notify');
  23. $this->gateway->setReturnUrl('https://www.example.com/return');
  24. $this->options = [
  25. 'out_trade_no' => '2014010122390001',
  26. 'subject' => 'test',
  27. 'total_fee' => '0.01',
  28. 'show_url' => 'https://www.example.com/item/123456',
  29. ];
  30. }
  31. public function testPurchase()
  32. {
  33. /**
  34. * @var LegacyWapPurchaseResponse $response
  35. */
  36. $response = $this->gateway->purchase($this->options)->send();
  37. $this->assertTrue($response->isRedirect());
  38. $this->assertTrue($response->isSuccessful());
  39. $this->assertNotEmpty($response->getRedirectUrl());
  40. }
  41. }