$eventDispatcher
$eventDispatcher : \Symfony\Component\EventDispatcher\EventDispatcherInterface
Queues mock responses or exceptions and delivers mock responses or exceptions in a fifo order.
$eventDispatcher : \Symfony\Component\EventDispatcher\EventDispatcherInterface
setEventDispatcher(\Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher) : self
Set the EventDispatcher of the request
\Symfony\Component\EventDispatcher\EventDispatcherInterface | $eventDispatcher |
getEventDispatcher() : \Symfony\Component\EventDispatcher\EventDispatcherInterface
Get the EventDispatcher of the request
dispatch(string $eventName, array $context = array()) : \Guzzle\Common\Event
Helper to dispatch Guzzle events and set the event name on the event
string | $eventName | Name of the event to dispatch |
array | $context | Context of the event |
Returns the created event object
addSubscriber(\Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber) : self
Add an event subscriber to the dispatcher
\Symfony\Component\EventDispatcher\EventSubscriberInterface | $subscriber | Event subscriber |
__construct(array $items = null, boolean $temporary = false, boolean $readBodies = false)
array | $items | Array of responses or exceptions to queue |
boolean | $temporary | Set to TRUE to remove the plugin when the queue is empty |
boolean | $readBodies | Set to TRUE to consume the entity body when a mock is served |
getSubscribedEvents() : array
Returns an array of event names this subscriber wants to listen to.
The array keys are event names and the value can be:
For instance:
The event names to listen to
getMockFile(string $path) : \Guzzle\Http\Message\Response
Get a mock response from a file
string | $path | File to retrieve a mock response from |
if the file is not found
addResponse(string|\Guzzle\Http\Message\Response $response) : \Guzzle\Plugin\Mock\MockPlugin
Add a response to the end of the queue
string|\Guzzle\Http\Message\Response | $response | Response object or path to response file |
if a string or Response is not passed
addException(\Guzzle\Http\Exception\CurlException $e) : \Guzzle\Plugin\Mock\MockPlugin
Add an exception to the end of the queue
\Guzzle\Http\Exception\CurlException | $e | Exception to throw when the request is executed |
clearQueue() : \Guzzle\Plugin\Mock\MockPlugin
Clear the queue
dequeue(\Guzzle\Http\Message\RequestInterface $request) : self
Get a response from the front of the list and add it to a request
\Guzzle\Http\Message\RequestInterface | $request | Request to mock |
When request.send is called and an exception is queued
onRequestBeforeSend(\Guzzle\Common\Event $event)
Called when a request is about to be sent
\Guzzle\Common\Event | $event |
When queue is empty