class FakeResponse implements FakeResponse

Traits

Properties

protected BodyRepository $body

The response body.

protected null|Throwable $responseException

The configured exception resolver.

Methods

static static
make(array|string $body = '[]', int $status = '200', array<string $, mixed> $headers = '[]')

No description

__construct(array|string $body = [], int $status = 200, array $headers = [])

Create a fake response.

body()

Get the response body repository.

int
status()

Get the response status.

array
headers()

Get the response headers.

throw(Closure|Throwable $value)

Configure an exception for the request.

Throwable|null
getException(PendingRequest $pendingRequest)

Resolve the configured exception.

static Fixture
fixture(string $name)

Create a fake response from a fixture.

ResponseInterface
createPsrResponse()

Create the PSR response.

Details

at line 22
static static make(array|string $body = '[]', int $status = '200', array<string $, mixed> $headers = '[]')

No description

Parameters

array|string $body
int $status
array<string $
mixed> $headers

Return Value

static

at line 44
__construct(array|string $body = [], int $status = 200, array $headers = [])

Create a fake response.

Parameters

array|string $body
int $status
array $headers

at line 57
BodyRepository body()

Get the response body repository.

Return Value

BodyRepository

at line 65
int status()

Get the response status.

Return Value

int

at line 75
array headers()

Get the response headers.

Return Value

array

at line 85
FakeResponse throw(Closure|Throwable $value)

Configure an exception for the request.

Parameters

Closure|Throwable $value

Return Value

FakeResponse

at line 97
Throwable|null getException(PendingRequest $pendingRequest)

Resolve the configured exception.

Parameters

PendingRequest $pendingRequest

Return Value

Throwable|null

at line 107
static Fixture fixture(string $name)

Create a fake response from a fixture.

Parameters

string $name

Return Value

Fixture

at line 115
ResponseInterface createPsrResponse()

Create the PSR response.

Return Value

ResponseInterface