Factory
Uses
See
- \Illuminate\Http\Client\PendingRequest
Properties
$recording bool
Indicates if the factory is recording requests and responses.
$recorded array
The recorded response array.
$responseSequences array
All created response sequences.
Methods
__construct ( Dispatcher $dispatcher ) : void
Create a new factory instance.
Parameters
- $dispatcher Dispatcher |null
response ( $body , $status , $headers ) : GuzzleHttp\...\PromiseInterface
Create a new response instance for use during stubbing.
Parameters
- $body array|string
- $status int
- $headers array
sequence ( array $responses ) : ResponseSequence
Get an invokable object that returns a sequence of responses in order for use during stubbing.
Parameters
- $responses array
fake ( $callback ) : $this
Register a stub callable that will intercept requests and be able to return stub responses.
Parameters
- $callback callable|array
fakeSequence ( $url ) : ResponseSequence
Register a response sequence for the given URL pattern.
Parameters
- $url string
stubUrl ( $url , $callback ) : $this
Stub the given URL using the given callback.
Parameters
- $url string
- $callback Response |GuzzleHttp\...\PromiseInterface|callable
record ( ) : $this
Begin recording request / response pairs.
recordRequestResponsePair ( $request , $response ) : void
Record a request response pair.
Parameters
assertSent ( $callback ) : void
Assert that a request / response pair was recorded matching a given truth test.
Parameters
- $callback callable
assertSentInOrder ( $callbacks ) : void
Assert that the given request was sent in the given order.
Parameters
- $callbacks array
assertNotSent ( $callback ) : void
Assert that a request / response pair was not recorded matching a given truth test.
Parameters
- $callback callable
assertNothingSent ( ) : void
Assert that no request / response pair was recorded.
assertSentCount ( $count ) : void
Assert how many requests have been recorded.
Parameters
- $count int
assertSequencesAreEmpty ( ) : void
Assert that every created response sequence is empty.
recorded ( $callback ) : Collection
Get a collection of the request / response pairs matching the given truth test.
Parameters
- $callback callable
newPendingRequest ( ) : PendingRequest
Create a new pending request instance for this factory.
__call ( $method , $parameters ) : mixed
Execute a method against a new pending request instance.
Parameters
- $method string
- $parameters array