oceanapplications/httpassertinsequence

Assert that request was sent at specific index of sequence

Installs: 189

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 0

Open Issues: 0

Type:project

pkg:composer/oceanapplications/httpassertinsequence

0.0.1 2020-07-27 23:27 UTC

This package is auto-updated.

Last update: 2025-09-29 02:51:36 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);