This commit is contained in:
Your Name
2026-08-25 09:35:47 +08:00
parent 1f3e580cf8
commit 01c38d8c5b
13 changed files with 855 additions and 92 deletions
@@ -94,4 +94,23 @@ $assert(($customerPayload['link_id'] ?? '') === 'link_1' && ($customerPayload['l
$chatPayload = json_decode((string) $history[6]['request']->getBody(), true);
$assert(($chatPayload['chat_key'] ?? '') === 'chat_key_1', 'get_chat_info 请求体不正确');
$invalidUserService = new QywxCustomerAcquisitionApiService(new Client([
'base_uri' => 'https://qyapi.weixin.qq.com/',
'handler' => HandlerStack::create(new MockHandler([
$json(['errcode' => 60111, 'errmsg' => "invalid string value `XiongCaiQian`: userid not found"]),
])),
'http_errors' => false,
]), static fn (): string => 'mock_token');
$invalidUserMessage = '';
try {
$invalidUserService->createLink([
'link_name' => '无效成员测试',
'range' => ['user_list' => ['XiongCaiQian']],
]);
} catch (RuntimeException $e) {
$invalidUserMessage = $e->getMessage();
}
$assert(str_contains($invalidUserMessage, 'userid 不存在'), '60111 应返回明确的成员绑定诊断提示');
$assert(str_contains($invalidUserMessage, '应用可见范围'), '60111 应提示检查应用可见范围');
echo "QYWX_CUSTOMER_ACQUISITION_API_TEST_OK\n";