-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
397 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yansongda\Pay\Tests\Shortcut\Wechat; | ||
|
||
use Yansongda\Pay\Plugin\Alipay\Pay\App\PayPlugin; | ||
use Yansongda\Pay\Plugin\ParserPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadBodyPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadSignaturePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\Pay\App\InvokePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\StartPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\VerifySignaturePlugin; | ||
use Yansongda\Pay\Shortcut\Wechat\AppShortcut; | ||
use Yansongda\Pay\Tests\TestCase; | ||
|
||
class AppShortcutTest extends TestCase | ||
{ | ||
protected AppShortcut $plugin; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->plugin = new AppShortcut(); | ||
} | ||
|
||
public function testDefault() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
PayPlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
InvokePlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins([])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yansongda\Pay\Tests\Shortcut\Wechat; | ||
|
||
use Yansongda\Pay\Plugin\ParserPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadBodyPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadSignaturePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\Pay\Mini\PayPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\StartPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\VerifySignaturePlugin; | ||
use Yansongda\Pay\Shortcut\Wechat\MiniShortcut; | ||
use Yansongda\Pay\Tests\TestCase; | ||
|
||
class MiniShortcutTest extends TestCase | ||
{ | ||
protected MiniShortcut $plugin; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->plugin = new MiniShortcut(); | ||
} | ||
|
||
public function testDefault() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
PayPlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins([])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yansongda\Pay\Tests\Shortcut\Wechat; | ||
|
||
use Yansongda\Pay\Plugin\ParserPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadBodyPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadSignaturePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\Pay\Jsapi\PayPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\StartPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\VerifySignaturePlugin; | ||
use Yansongda\Pay\Shortcut\Wechat\MpShortcut; | ||
use Yansongda\Pay\Tests\TestCase; | ||
|
||
class MpShortcutTest extends TestCase | ||
{ | ||
protected MpShortcut $plugin; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->plugin = new MpShortcut(); | ||
} | ||
|
||
public function testDefault() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
PayPlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins([])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yansongda\Pay\Tests\Shortcut\Wechat; | ||
|
||
use Yansongda\Pay\Exception\Exception; | ||
use Yansongda\Pay\Exception\InvalidParamsException; | ||
use Yansongda\Pay\Plugin\ParserPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadBodyPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadSignaturePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\Pay\App\RefundPlugin as AppRefundPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\Pay\Combine\RefundPlugin as CombineRefundPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\Pay\H5\RefundPlugin as H5RefundPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\Pay\Jsapi\RefundPlugin as JsapiRefundPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\Pay\Mini\RefundPlugin as MiniRefundPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\Pay\Native\RefundPlugin as NativeRefundPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\StartPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\VerifySignaturePlugin; | ||
use Yansongda\Pay\Shortcut\Wechat\RefundShortcut; | ||
use Yansongda\Pay\Tests\TestCase; | ||
|
||
class RefundShortcutTest extends TestCase | ||
{ | ||
protected RefundShortcut $plugin; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->plugin = new RefundShortcut(); | ||
} | ||
|
||
public function testDefault() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
JsapiRefundPlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins([])); | ||
} | ||
|
||
public function testApp() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
AppRefundPlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins(['_action' => 'app'])); | ||
} | ||
|
||
public function testCombine() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
CombineRefundPlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins(['_action' => 'combine'])); | ||
} | ||
|
||
public function testH5() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
H5RefundPlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins(['_action' => 'h5'])); | ||
} | ||
|
||
public function testJsapi() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
JsapiRefundPlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins(['_action' => 'jsapi'])); | ||
} | ||
|
||
public function testMini() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
MiniRefundPlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins(['_action' => 'mini'])); | ||
} | ||
|
||
public function testNative() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
NativeRefundPlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins(['_action' => 'native'])); | ||
} | ||
|
||
|
||
public function testFoo() | ||
{ | ||
self::expectException(InvalidParamsException::class); | ||
self::expectExceptionCode(Exception::PARAMS_SHORTCUT_ACTION_INVALID); | ||
self::expectExceptionMessage('Refund action [fooPlugins] not supported'); | ||
|
||
$this->plugin->getPlugins(['_action' => 'foo']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yansongda\Pay\Tests\Shortcut\Wechat; | ||
|
||
use Yansongda\Pay\Plugin\ParserPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadBodyPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadSignaturePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\Pay\Native\PayPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\StartPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\VerifySignaturePlugin; | ||
use Yansongda\Pay\Shortcut\Wechat\ScanShortcut; | ||
use Yansongda\Pay\Tests\TestCase; | ||
|
||
class ScanShortcutTest extends TestCase | ||
{ | ||
protected ScanShortcut $plugin; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->plugin = new ScanShortcut(); | ||
} | ||
|
||
public function testDefault() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
PayPlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins([])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yansongda\Pay\Tests\Shortcut\Wechat; | ||
|
||
use Yansongda\Pay\Plugin\ParserPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadBodyPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddPayloadSignaturePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\AddRadarPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\Marketing\Transfer\CreatePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\ResponsePlugin; | ||
use Yansongda\Pay\Plugin\Wechat\StartPlugin; | ||
use Yansongda\Pay\Plugin\Wechat\VerifySignaturePlugin; | ||
use Yansongda\Pay\Shortcut\Wechat\TransferShortcut; | ||
use Yansongda\Pay\Tests\TestCase; | ||
|
||
class TransferShortcutTest extends TestCase | ||
{ | ||
protected TransferShortcut $plugin; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->plugin = new TransferShortcut(); | ||
} | ||
|
||
public function testDefault() | ||
{ | ||
self::assertEquals([ | ||
StartPlugin::class, | ||
CreatePlugin::class, | ||
AddPayloadBodyPlugin::class, | ||
AddPayloadSignaturePlugin::class, | ||
AddRadarPlugin::class, | ||
ResponsePlugin::class, | ||
VerifySignaturePlugin::class, | ||
ParserPlugin::class, | ||
], $this->plugin->getPlugins([])); | ||
} | ||
} |
Oops, something went wrong.