HttpRequestFactoryTest
extends GuzzleTestCase
in package
Base testcase class for all Guzzle testcases.
Tags
Table of Contents
- $mockObserver : mixed
- $server : mixed
- $serviceBuilder : mixed
- $mockBasePath : 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
- getWildcardObserver() : MockObserver
- Get a wildcard observer for an event dispatcher
- inputValidation() : 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
- testBugPathIncorrectlyHandled() : mixed
- testCachesSingletonInstance() : mixed
- testCanAddBasicAuth() : mixed
- testCanAddCookies() : mixed
- testCanAddDigestAuth() : mixed
- testCanAddEvents() : mixed
- testCanAddEventsWithPriority() : mixed
- testCanAddPlugins() : mixed
- testCanAddQueryString() : mixed
- testCanAddRequestParams() : mixed
- testCanAddSslCert() : mixed
- testCanAddSslCertPassword() : mixed
- testCanAddSslKey() : mixed
- testCanAddSslKeyPassword() : mixed
- testCanChangeSaveToLocation() : mixed
- testCanDisableExceptions() : mixed
- testCanDisableExceptionsWithErrorListener() : mixed
- testCanDisableRedirects() : mixed
- testCanSetBodyOption() : mixed
- testCanSetConnectTimeoutOption() : mixed
- testCanSetDebug() : mixed
- testCanSetDefaultHeadersOptions() : mixed
- testCanSetDefaultQueryString() : mixed
- testCanSetHeadersOption() : mixed
- testCanSetProxy() : mixed
- testCanSetTimeoutOption() : mixed
- testCanSetVerifyToOff() : mixed
- testCanSetVerifyToOn() : mixed
- testCanSetVerifyToPath() : mixed
- testClonesRequestsWithMethodWithClient() : mixed
- testClonesRequestsWithMethodWithClientWithEntityEnclosingChange() : mixed
- testClonesRequestsWithMethodWithoutClient() : mixed
- testCreatesBodyWithoutZeroString() : mixed
- testCreatesFromMessage() : mixed
- testCreatesFromParts() : mixed
- testCreatesHeadAndDeleteRequests() : mixed
- testCreatesHttpMessagesWithBodiesAndNormalizesLineEndings() : mixed
- testCreatesNewGetRequests() : mixed
- testCreatesNewPostRequestWithFields() : mixed
- testCreatesNewPutRequestWithBody() : mixed
- testCreatesNewTraceRequest() : mixed
- testCreatesOptionsRequests() : mixed
- testCreatesProperTransferEncodingRequests() : mixed
- testCreatesPutRequests() : mixed
- testHandlesChunkedTransferEncoding() : mixed
- testProperlyDealsWithDuplicateHeaders() : mixed
- testValidatesBodyOption() : mixed
- testValidatesInput() : mixed
- hasSubscriber() : bool
- Check if an event dispatcher has a subscriber
Properties
$mockObserver
public
mixed
$mockObserver
$server
public
static mixed
$server
$serviceBuilder
public
static mixed
$serviceBuilder
$mockBasePath
protected
static mixed
$mockBasePath
$requests
private
mixed
$requests
= array()
Methods
addMockedRequest()
Mark a request as being mocked
public
addMockedRequest(RequestInterface $request) : self
Parameters
- $request : RequestInterface
Return values
self —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 —getServiceBuilder()
Get a service builder object that can be used throughout the service tests
public
static getServiceBuilder() : ServiceBuilder
Return values
ServiceBuilder —getWildcardObserver()
Get a wildcard observer for an event dispatcher
public
getWildcardObserver(HasDispatcherInterface $hasDispatcher) : MockObserver
Parameters
- $hasDispatcher : HasDispatcherInterface
Return values
MockObserver —inputValidation()
public
inputValidation() : mixed
Return values
mixed —setMockBasePath()
Set the mock response base path
public
static setMockBasePath(string $path) : GuzzleTestCase
Parameters
- $path : string
-
Path to mock response folder
Return values
GuzzleTestCase —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
setServiceBuilder()
Set the service builder to use for tests
public
static setServiceBuilder(ServiceBuilderInterface $builder) : mixed
Parameters
- $builder : ServiceBuilderInterface
-
Service builder
Return values
mixed —testBugPathIncorrectlyHandled()
public
testBugPathIncorrectlyHandled() : mixed
Return values
mixed —testCachesSingletonInstance()
public
testCachesSingletonInstance() : mixed
Return values
mixed —testCanAddBasicAuth()
public
testCanAddBasicAuth() : mixed
Return values
mixed —testCanAddCookies()
public
testCanAddCookies() : mixed
Return values
mixed —testCanAddDigestAuth()
public
testCanAddDigestAuth() : mixed
Return values
mixed —testCanAddEvents()
public
testCanAddEvents() : mixed
Return values
mixed —testCanAddEventsWithPriority()
public
testCanAddEventsWithPriority() : mixed
Return values
mixed —testCanAddPlugins()
public
testCanAddPlugins() : mixed
Return values
mixed —testCanAddQueryString()
public
testCanAddQueryString() : mixed
Return values
mixed —testCanAddRequestParams()
public
testCanAddRequestParams() : mixed
Return values
mixed —testCanAddSslCert()
public
testCanAddSslCert() : mixed
Return values
mixed —testCanAddSslCertPassword()
public
testCanAddSslCertPassword() : mixed
Return values
mixed —testCanAddSslKey()
public
testCanAddSslKey() : mixed
Return values
mixed —testCanAddSslKeyPassword()
public
testCanAddSslKeyPassword() : mixed
Return values
mixed —testCanChangeSaveToLocation()
public
testCanChangeSaveToLocation() : mixed
Return values
mixed —testCanDisableExceptions()
public
testCanDisableExceptions() : mixed
Return values
mixed —testCanDisableExceptionsWithErrorListener()
public
testCanDisableExceptionsWithErrorListener() : mixed
Return values
mixed —testCanDisableRedirects()
public
testCanDisableRedirects() : mixed
Return values
mixed —testCanSetBodyOption()
public
testCanSetBodyOption() : mixed
Return values
mixed —testCanSetConnectTimeoutOption()
public
testCanSetConnectTimeoutOption() : mixed
Return values
mixed —testCanSetDebug()
public
testCanSetDebug() : mixed
Return values
mixed —testCanSetDefaultHeadersOptions()
public
testCanSetDefaultHeadersOptions() : mixed
Return values
mixed —testCanSetDefaultQueryString()
public
testCanSetDefaultQueryString() : mixed
Return values
mixed —testCanSetHeadersOption()
public
testCanSetHeadersOption() : mixed
Return values
mixed —testCanSetProxy()
public
testCanSetProxy() : mixed
Return values
mixed —testCanSetTimeoutOption()
public
testCanSetTimeoutOption() : mixed
Return values
mixed —testCanSetVerifyToOff()
public
testCanSetVerifyToOff() : mixed
Return values
mixed —testCanSetVerifyToOn()
public
testCanSetVerifyToOn() : mixed
Return values
mixed —testCanSetVerifyToPath()
public
testCanSetVerifyToPath() : mixed
Return values
mixed —testClonesRequestsWithMethodWithClient()
public
testClonesRequestsWithMethodWithClient() : mixed
Return values
mixed —testClonesRequestsWithMethodWithClientWithEntityEnclosingChange()
public
testClonesRequestsWithMethodWithClientWithEntityEnclosingChange() : mixed
Return values
mixed —testClonesRequestsWithMethodWithoutClient()
public
testClonesRequestsWithMethodWithoutClient() : mixed
Return values
mixed —testCreatesBodyWithoutZeroString()
public
testCreatesBodyWithoutZeroString() : mixed
Return values
mixed —testCreatesFromMessage()
public
testCreatesFromMessage() : mixed
Return values
mixed —testCreatesFromParts()
public
testCreatesFromParts() : mixed
Return values
mixed —testCreatesHeadAndDeleteRequests()
public
testCreatesHeadAndDeleteRequests() : mixed
Return values
mixed —testCreatesHttpMessagesWithBodiesAndNormalizesLineEndings()
public
testCreatesHttpMessagesWithBodiesAndNormalizesLineEndings() : mixed
Return values
mixed —testCreatesNewGetRequests()
public
testCreatesNewGetRequests() : mixed
Return values
mixed —testCreatesNewPostRequestWithFields()
public
testCreatesNewPostRequestWithFields() : mixed
Return values
mixed —testCreatesNewPutRequestWithBody()
public
testCreatesNewPutRequestWithBody() : mixed
Return values
mixed —testCreatesNewTraceRequest()
public
testCreatesNewTraceRequest() : mixed
Return values
mixed —testCreatesOptionsRequests()
public
testCreatesOptionsRequests() : mixed
Return values
mixed —testCreatesProperTransferEncodingRequests()
public
testCreatesProperTransferEncodingRequests() : mixed
Return values
mixed —testCreatesPutRequests()
public
testCreatesPutRequests() : mixed
Return values
mixed —testHandlesChunkedTransferEncoding()
public
testHandlesChunkedTransferEncoding() : mixed
Return values
mixed —testProperlyDealsWithDuplicateHeaders()
public
testProperlyDealsWithDuplicateHeaders() : mixed
Return values
mixed —testValidatesBodyOption()
public
testValidatesBodyOption() : mixed
Tags
Return values
mixed —testValidatesInput()
public
testValidatesInput(mixed $option) : mixed
Parameters
- $option : mixed
Tags
Return values
mixed —hasSubscriber()
Check if an event dispatcher has a subscriber
protected
hasSubscriber(HasDispatcherInterface $dispatcher, EventSubscriberInterface $subscriber) : bool
Parameters
- $dispatcher : HasDispatcherInterface
- $subscriber : EventSubscriberInterface