Documentation

BackoffPluginTest extends GuzzleTestCase
in package
implements EventSubscriberInterface

Base testcase class for all Guzzle testcases.

Tags
group

server

covers

Interfaces, Classes and Traits

EventSubscriberInterface
An EventSubscriber knows itself what events it is interested in.

Table of Contents

$mockObserver  : mixed
$server  : mixed
$serviceBuilder  : mixed
$mockBasePath  : mixed
$retried  : mixed
$requests  : mixed
addMockedRequest()  : self
Mark a request as being mocked
assertContainsIns()  : mixed
Case insensitive assertContains
compareHeaders()  : array<string|int, mixed>|bool
Compare HTTP headers and use special markup to filter values A header prefixed with '!' means it must not exist A header prefixed with '_' means it must be ignored A header value of '*' means anything after the * will be ignored
getMockedRequests()  : array<string|int, mixed>
Get all of the mocked requests
getMockResponse()  : Response
Get a mock response for a client by mock file name
getServer()  : Server
Get the global server object used throughout the unit tests of Guzzle
getServiceBuilder()  : ServiceBuilder
Get a service builder object that can be used throughout the service tests
getSubscribedEvents()  : array<string|int, mixed>
Returns an array of event names this subscriber wants to listen to.
getWildcardObserver()  : MockObserver
Get a wildcard observer for an event dispatcher
onRequestRetry()  : mixed
setMockBasePath()  : GuzzleTestCase
Set the mock response base path
setMockResponse()  : MockPlugin
Set a mock response from a mock file on the next client request.
setServiceBuilder()  : mixed
Set the service builder to use for tests
setUp()  : mixed
testCreatesDefaultExponentialBackoffPlugin()  : mixed
testDoesNothingWhenNotRetryingAndPollingRequest()  : mixed
testDoesNotRetryUnlessStrategyReturnsNumber()  : mixed
testDoesNotSeekOnRequestsWithNoBodyWhenRetrying()  : mixed
testFailsOnTruncation()  : mixed
testHasEventList()  : mixed
testRetriesPooledRequestsUsingDelayAndPollingEvent()  : mixed
testRetriesRequests()  : mixed
testRetriesRequestsWhenInParallel()  : mixed
testSeeksToBeginningOfRequestBodyWhenRetrying()  : mixed
testUpdatesRequestForRetry()  : mixed
getMockEvent()  : mixed
hasSubscriber()  : bool
Check if an event dispatcher has a subscriber

Properties

Methods

assertContainsIns()

Case insensitive assertContains

public assertContainsIns(string $needle, string $haystack[, string $message = null ]) : mixed
Parameters
$needle : string

Search string

$haystack : string

Search this

$message : string = null

Optional failure message

Return values
mixed

compareHeaders()

Compare HTTP headers and use special markup to filter values A header prefixed with '!' means it must not exist A header prefixed with '_' means it must be ignored A header value of '*' means anything after the * will be ignored

public compareHeaders(array<string|int, mixed> $filteredHeaders, array<string|int, mixed> $actualHeaders) : array<string|int, mixed>|bool
Parameters
$filteredHeaders : array<string|int, mixed>

Array of special headers

$actualHeaders : array<string|int, mixed>

Array of headers to check against

Return values
array<string|int, mixed>|bool

Returns an array of the differences or FALSE if none

getMockedRequests()

Get all of the mocked requests

public getMockedRequests() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMockResponse()

Get a mock response for a client by mock file name

public getMockResponse(string $path) : Response
Parameters
$path : string

Relative path to the mock response file

Return values
Response

getServer()

Get the global server object used throughout the unit tests of Guzzle

public static getServer() : Server
Return values
Server

getSubscribedEvents()

Returns an array of event names this subscriber wants to listen to.

public static getSubscribedEvents() : array<string|int, mixed>

The array keys are event names and the value can be:

  • The method name to call (priority defaults to 0)
  • An array composed of the method name to call and the priority
  • An array of arrays composed of the method names to call and respective priorities, or 0 if unset

For instance:

  • ['eventName' => 'methodName']
  • ['eventName' => ['methodName', $priority]]
  • ['eventName' => [['methodName1', $priority], ['methodName2']]]

The code must not depend on runtime state as it will only be called at compile time. All logic depending on runtime state must be put into the individual methods handling the events.

Return values
array<string|int, mixed>

The event names to listen to

setMockResponse()

Set a mock response from a mock file on the next client request.

public setMockResponse(Client $client, string $paths) : MockPlugin

This method assumes that mock response files are located under the Command/Mock/ directory of the Service being tested (e.g. Unfuddle/Command/Mock/). A mock response is added to the next request sent by the client.

Parameters
$client : Client

Client object to modify

$paths : string

Path to files within the Mock folder of the service

Return values
MockPlugin

returns the created mock plugin

testCreatesDefaultExponentialBackoffPlugin()

public testCreatesDefaultExponentialBackoffPlugin() : mixed
Return values
mixed

testDoesNothingWhenNotRetryingAndPollingRequest()

public testDoesNothingWhenNotRetryingAndPollingRequest() : mixed
Return values
mixed

testDoesNotRetryUnlessStrategyReturnsNumber()

public testDoesNotRetryUnlessStrategyReturnsNumber() : mixed
Return values
mixed

testDoesNotSeekOnRequestsWithNoBodyWhenRetrying()

public testDoesNotSeekOnRequestsWithNoBodyWhenRetrying() : mixed
Return values
mixed

testFailsOnTruncation()

public testFailsOnTruncation() : mixed
Tags
expectedException

\Guzzle\Http\Exception\ServerErrorResponseException

Return values
mixed

testHasEventList()

public testHasEventList() : mixed
Return values
mixed

testRetriesPooledRequestsUsingDelayAndPollingEvent()

public testRetriesPooledRequestsUsingDelayAndPollingEvent() : mixed
Tags
covers
covers
Return values
mixed

testRetriesRequests()

public testRetriesRequests() : mixed
Return values
mixed

testRetriesRequestsWhenInParallel()

public testRetriesRequestsWhenInParallel() : mixed
Return values
mixed

testSeeksToBeginningOfRequestBodyWhenRetrying()

public testSeeksToBeginningOfRequestBodyWhenRetrying() : mixed
Return values
mixed

testUpdatesRequestForRetry()

public testUpdatesRequestForRetry() : mixed
Return values
mixed

Search results