Skip to content

Commit

Permalink
Optimize submitAudit function. (w7corp#1901)
Browse files Browse the repository at this point in the history
  • Loading branch information
her-cat authored Jul 27, 2020
1 parent 02e8c57 commit 967932c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/OpenPlatform/Authorizer/MiniProgram/Code/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getPage()
}

/**
* @param array $itemList
* @param array $data
* @param string|null $feedbackInfo
* @param string|null $feedbackStuff
*
Expand All @@ -86,10 +86,14 @@ public function getPage()
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function submitAudit(array $itemList, string $feedbackInfo = null, string $feedbackStuff = null)
public function submitAudit(array $data, string $feedbackInfo = null, string $feedbackStuff = null)
{
if (isset($data['item_list'])) {
return $this->httpPostJson('wxa/submit_audit', $data);
}

return $this->httpPostJson('wxa/submit_audit', [
'item_list' => $itemList,
'item_list' => $data,
'feedback_info' => $feedbackInfo,
'feedback_stuff' => $feedbackStuff,
]);
Expand Down
4 changes: 4 additions & 0 deletions tests/OpenPlatform/Authorizer/MiniProgram/Code/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public function testSubmitAudit()
$client = $this->mockApiClient(Client::class, [], new ServiceContainer(['app_id' => 'app-id']));
$client->expects()->httpPostJson('wxa/submit_audit', ['item_list' => ['foo', 'bar'], 'feedback_info' => 'foo', 'feedback_stuff' => 'foo'])->andReturn('mock-result');
$this->assertSame('mock-result', $client->submitAudit(['foo', 'bar'], 'foo', 'foo'));

$data = ['item_list' => ['foo', 'bar'], 'feedback_info' => 'foo', 'feedback_stuff' => 'foo', 'preview_info' => 'bar'];
$client->expects()->httpPostJson('wxa/submit_audit', $data)->andReturn('mock-result');
$this->assertSame('mock-result', $client->submitAudit($data));
}

public function testGetAuditStatus()
Expand Down

0 comments on commit 967932c

Please sign in to comment.