Mock
in package
implements
MockInterface
Class Mock
Tags
Interfaces, Classes, Traits and Enums
- MockInterface
- Interface MockInterface
Table of Contents
- __construct() : mixed
- Mock constructor.
- available() : bool
- Returns true if mock is still can be used.
- getReplyFactory() : ReplyFactoryInterface|null
- Returns reply factory which should be used to form the mocked response.
- getResponse() : ResponseInterface|null
- Returns response which should be used as mock data.
- getThrowable() : Throwable|null
- Returns the throwable which will be thrown as mock data.
- matches() : bool
- Returns true if underlying matcher has matched provided request.
- registerHit() : MockInterface
- Registers a hit to the mock.
Methods
__construct()
Mock constructor.
public
__construct(RequestMatcherInterface $matcher, ReplyFactoryInterface|null $replyFactory, ResponseInterface|null $response, Throwable|null $throwable, int $maxHits, int $matchAt) : mixed
Parameters
- $matcher : RequestMatcherInterface
- $replyFactory : ReplyFactoryInterface|null
- $response : ResponseInterface|null
- $throwable : Throwable|null
- $maxHits : int
- $matchAt : int
Return values
mixed —available()
Returns true if mock is still can be used.
public
available() : bool
Tags
Return values
bool —getReplyFactory()
Returns reply factory which should be used to form the mocked response.
public
getReplyFactory() : ReplyFactoryInterface|null
Tags
Return values
ReplyFactoryInterface|null —getResponse()
Returns response which should be used as mock data.
public
getResponse() : ResponseInterface|null
Tags
Return values
ResponseInterface|null —getThrowable()
Returns the throwable which will be thrown as mock data.
public
getThrowable(RequestInterface $request) : Throwable|null
Parameters
- $request : RequestInterface
-
This request may be set into exception if possible
Tags
Return values
Throwable|null —matches()
Returns true if underlying matcher has matched provided request.
public
matches(RequestInterface $request) : bool
Parameters
- $request : RequestInterface
Tags
Return values
bool —registerHit()
Registers a hit to the mock.
public
registerHit() : MockInterface