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.
yanzong/vendor/alipaysdk/easysdk/php/test/payment/page/ClientTest.php

36 lines
1.4 KiB

<?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);
}
}