Skip to content

Commit

Permalink
optim assertInstanceOf($expected, $e) syntax for PHP7
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNorthMemory committed Dec 22, 2024
1 parent 8866d1a commit 4f63d58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/OpenAPI/V2/Tools/AuthcodetoopenidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private function prepareEnvironment(string $secret): \WeChatPay\BuilderChainable
}

/**
* @return array<string,array{array<string,?string>,string,?string}>
* @return array<string,array{array<string,?string>,string,?class-string}>
*/
public function mockDataProvider(): array
{
Expand Down Expand Up @@ -107,7 +107,7 @@ public function mockDataProvider(): array
* @dataProvider mockDataProvider
* @param array<string,string> $data
* @param string $secret
* @param ?string $expected
* @param ?class-string $expected
*/
public function testResponseState(array $data, string $secret, ?string $expected = null): void
{
Expand All @@ -123,7 +123,7 @@ public function testResponseState(array $data, string $secret, ?string $expected
try {
$endpoint->post(['xml' => ['appid' => '123', 'mch_id' => '123', 'auth_code' => '123']]);
} catch (\Throwable $e) {
self::assertEquals($expected, $e::class);
self::assertInstanceOf($expected, $e);
if ($e instanceof RejectionException && ($response = $e->getReason()) instanceof ResponseInterface) {
$err = Transformer::toArray((string)$response->getBody());
//three cases, maybe return_code and/or result_code 'FAIL'
Expand Down

0 comments on commit 4f63d58

Please sign in to comment.