Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asserting a request is sent by closure parameter #417

Closed
innocenzi opened this issue May 22, 2024 · 1 comment · May be fixed by #424
Closed

Asserting a request is sent by closure parameter #417

innocenzi opened this issue May 22, 2024 · 1 comment · May be fixed by #424

Comments

@innocenzi
Copy link

Take the following snippet:

MockClient::getGlobal()->assertSent(function (CreateDealRequest $request) {
    expect($request->body()->all())->toMatchArray([
        'title' => '[MGT] Jon Doe / foo - bar / ' . now()->addDay()->format('M d \'y'),
        'status' => DealStatus::OPEN,
    ]);
});

This would fail if there was a request other than CreateDealRequest. It would be great if assertSent could take the request type into account.

Open to PRing that 👍

@Sammyjo20
Copy link
Collaborator

Thank you for PRing this! I'm going to close this as it's now a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants