Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR adds an
Confidence Score: 5/5
Last reviewed commit: 76a8c75 |
| public function testAcceptInvitation404() | ||
| { | ||
| $invitationId = "invitation_01E4ZCR3C56J083X43JQXF3JK5"; | ||
| $path = "user_management/invitations/{$invitationId}/accept"; | ||
|
|
||
| $this->expectException(Exception\NotFoundException::class); | ||
|
|
||
| $this->mockRequest( | ||
| Client::METHOD_POST, | ||
| $path, | ||
| null, | ||
| null, | ||
| true, | ||
| null, | ||
| null, | ||
| 404 | ||
| ); | ||
|
|
||
| $this->userManagement->acceptInvitation($invitationId); | ||
| } |
There was a problem hiding this comment.
Missing 400-level error test cases
The comparable resendInvitation tests cover several 400 error scenarios (testResendInvitationExpired, testResendInvitationRevoked, testResendInvitationAccepted), but acceptInvitation only tests 404. In practice, the accept endpoint can also return a 400 when the invitation is in an invalid state (e.g. already accepted, revoked, or expired). Consider adding at least one BadRequestException test, mirroring the pattern used for the resend tests:
public function testAcceptInvitationAlreadyAccepted()
{
$invitationId = "invitation_01E4ZCR3C56J083X43JQXF3JK5";
$path = "user_management/invitations/{$invitationId}/accept";
$this->expectException(Exception\BadRequestException::class);
$this->mockRequest(
Client::METHOD_POST,
$path,
null,
null,
true,
null,
null,
400
);
$this->userManagement->acceptInvitation($invitationId);
}
Summary
acceptInvitation($invitationId)method toUserManagementclassPOST /user_management/invitations/{id}/acceptto accept a pending invitationTest plan
testAcceptInvitation— verifies successful acceptance returns Invitation resourcetestAcceptInvitation404— verifies 404 throws NotFoundException🤖 Generated with Claude Code