You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.3 KiB
36 lines
1.3 KiB
11 months ago
|
<?php
|
||
|
|
||
|
use Alipay\EasySDK\Kernel\Factory;
|
||
|
use Alipay\EasySDK\Test\TestAccount;
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
|
||
|
class ClientTest extends TestCase
|
||
|
{
|
||
|
public function __construct($name = null, array $data = [], $dataName = '')
|
||
|
{
|
||
|
parent::__construct($name, $data, $dataName);
|
||
|
$account = new TestAccount();
|
||
|
Factory::setOptions($account->getTestAccount());
|
||
|
}
|
||
|
|
||
|
public function testPay()
|
||
|
{
|
||
|
$create = Factory::payment()->common()->create("Iphone6 16G",
|
||
|
microtime(), "88.88", "2088002656718920");
|
||
|
$result = Factory::payment()->page()->pay("Iphone6 16G", $create->outTradeNo, "0.10", "https://www.taobao.com");
|
||
|
$this->assertEquals(true, strpos($result->body, 'alipay-easysdk-php-') > 0);
|
||
|
$this->assertEquals(true, strpos($result->body, 'sign') > 0);
|
||
|
}
|
||
|
|
||
|
public function testPayWithOptionalNotify()
|
||
|
{
|
||
|
$create = Factory::payment()->common()->create("Iphone6 16G",
|
||
|
microtime(), "88.88", "2088002656718920");
|
||
|
$result = Factory::payment()->page()
|
||
|
->asyncNotify("https://www.test2.com/newCallback")
|
||
|
->pay("Iphone6 16G", $create->outTradeNo, "0.10", "https://www.taobao.com");
|
||
|
$this->assertEquals(true, strpos($result->body, 'alipay-easysdk-php-') > 0);
|
||
|
$this->assertEquals(true, strpos($result->body, 'sign') > 0);
|
||
|
}
|
||
|
|
||
|
}
|