oceanapplications / httpassertinsequence
Assert that request was sent at specific index of sequence
Installs: 151
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
This package is auto-updated.
Last update: 2024-12-29 06:39:48 UTC
README
composer require oceanapplications/httpassertinsequence
Add or replace the http alias in app/config with
'Http' => OceanApplications\HttpAssertInSequence\Http::class,
Use alias in all your files
use Http;
Usage
Works just like assertSent but allows you to specify which request to check
Http::fake([
'*' => Http::sequence()
->push(['data' => [ [] ] ], 200) // get customer, none found
->push(['data' => ['id' => 1] ], 200) // create customer
]);
$response = $this->post('createOrUpdate', ['email' => 'test@example.com']);
Http::assertSentInSequence(function(Request $request) {
return $request['email'] == 'test@example.com';
}, 1);