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

[7.x] Add assertSentCount HTTP client assertion #32407

Merged
merged 1 commit into from
Apr 16, 2020
Merged

[7.x] Add assertSentCount HTTP client assertion #32407

merged 1 commit into from
Apr 16, 2020

Conversation

christophrumpel
Copy link
Contributor

This PR adds a new HTTP client assertion called assertSentCount.

Next to the given assertions, it is also useful to count the recorded requests. This way you can make sure your code only sends x amount of requests and you do not have to be more specific how they look like. Here is an example:

$this->factory->fake();

$this->factory->assertSentCount(0);

$this->factory->post('http://foo.com/form', [
       'name' => 'Taylor',
]);

$this->factory->assertSentCount(1);

$this->factory->post('http://foo.com/form', [
       'name' => 'Jim',
]);

$this->factory->assertSentCount(2);

@taylorotwell taylorotwell merged commit b92e27d into laravel:7.x Apr 16, 2020
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 this pull request may close these issues.

2 participants