pay/tests/Plugin/Alipay/RadarPluginTest.php

37 lines
1.0 KiB
PHP
Raw Normal View History

2021-06-07 22:18:15 +08:00
<?php
namespace Yansongda\Pay\Tests\Plugin\Alipay;
use Yansongda\Pay\Plugin\Alipay\RadarPlugin;
use Yansongda\Pay\Rocket;
2021-07-17 15:37:43 +08:00
use Yansongda\Pay\Tests\TestCase;
2021-06-07 22:18:15 +08:00
use Yansongda\Supports\Collection;
class RadarPluginTest extends TestCase
{
public function testPostNormal()
{
$rocket = new Rocket();
$rocket->setParams([])->setPayload(new Collection(['name' => 'yansongda']));
$plugin = new RadarPlugin();
$result = $plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals('name=yansongda', $result->getRadar()->getBody()->getContents());
self::assertEquals('POST', $result->getRadar()->getMethod());
}
public function testGetNormal()
{
$rocket = new Rocket();
$rocket->setParams(['_method' => 'get'])->setPayload(new Collection(['name' => 'yansongda']));
$plugin = new RadarPlugin();
$result = $plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals('GET', $result->getRadar()->getMethod());
}
}