Documentation

RequestTest extends GuzzleTestCase
in package

Base testcase class for all Guzzle testcases.

Tags
group

server

covers
covers

Table of Contents

$mockObserver  : mixed
$server  : mixed
$serviceBuilder  : mixed
$client  : Client
$mockBasePath  : mixed
$request  : Request
$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
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
tearDown()  : mixed
testAllowsFilenameForDownloadingContent()  : mixed
testCanChangePortThroughScheme()  : mixed
testCanOverrideUnsuccessfulResponses()  : mixed
testCanRetrieveUrlObject()  : mixed
testCanSendCustomRequests()  : mixed
testCanShortCircuitErrorHandling()  : mixed
testClonedRequestsUseNewInternalState()  : mixed
testConstructorBuildsRequestWithArrayHeaders()  : mixed
testConstructorBuildsRequestWithCollectionHeaders()  : mixed
testConstructorBuildsRequestWithNoHeaders()  : mixed
testConstructorHandlesNonBasicAuth()  : mixed
testDescribesEvents()  : mixed
testEnsuresFileCanBeCreated()  : mixed
testGetEventDispatcher()  : mixed
testGetResourceUri()  : mixed
testGetResponse()  : mixed
testHoldsCookies()  : mixed
testManagesQuery()  : mixed
testPermitsFalsyComponents()  : mixed
testRecognizesBasicAuthCredentialsInUrls()  : mixed
testRequestCanBeSentUsingCurl()  : mixed
testRequestCanHaveManuallySetResponseBody()  : mixed
testRequestHandlesAuthorization()  : mixed
testRequestHasHost()  : mixed
testRequestHasMethod()  : mixed
testRequestHasMutableUrl()  : mixed
testRequestHasPath()  : mixed
testRequestHasPort()  : mixed
testRequestHasProtocol()  : mixed
testRequestHasScheme()  : mixed
testRequestHasState()  : mixed
testRequestsCanBeConvertedToRawMessageStrings()  : mixed
testRequestsManageClients()  : mixed
testRequestsRequireClients()  : mixed
testRequestStringsIncludeAuth()  : mixed
Add authorization after the fact and see that it was put in the message
testRequestThrowsExceptionOnBadResponse()  : mixed
testRequestThrowsExceptionWhenSetToCompleteWithNoResponse()  : mixed
testSend()  : mixed
testSetManualResponse()  : mixed
testThrowsExceptionsWhenUnsuccessfulResponseIsReceivedByDefault()  : mixed
testUnresolvedRedirectsReturnResponse()  : mixed
testUsesCustomResponseBodyWhenItIsCustom()  : mixed
testValidatesAuth()  : mixed
hasSubscriber()  : bool
Check if an event dispatcher has a subscriber
setUp()  : mixed

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

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

tearDown()

public tearDown() : mixed
Return values
mixed

testAllowsFilenameForDownloadingContent()

public testAllowsFilenameForDownloadingContent() : mixed
Return values
mixed

testCanChangePortThroughScheme()

public testCanChangePortThroughScheme() : mixed
Return values
mixed

testCanOverrideUnsuccessfulResponses()

public testCanOverrideUnsuccessfulResponses() : mixed
Return values
mixed

testCanRetrieveUrlObject()

public testCanRetrieveUrlObject() : mixed
Return values
mixed

testCanSendCustomRequests()

public testCanSendCustomRequests() : mixed
Return values
mixed

testCanShortCircuitErrorHandling()

public testCanShortCircuitErrorHandling() : mixed
Return values
mixed

testClonedRequestsUseNewInternalState()

public testClonedRequestsUseNewInternalState() : mixed
Return values
mixed

testConstructorBuildsRequestWithArrayHeaders()

public testConstructorBuildsRequestWithArrayHeaders() : mixed
Return values
mixed

testConstructorBuildsRequestWithCollectionHeaders()

public testConstructorBuildsRequestWithCollectionHeaders() : mixed
Return values
mixed

testConstructorBuildsRequestWithNoHeaders()

public testConstructorBuildsRequestWithNoHeaders() : mixed
Return values
mixed

testConstructorHandlesNonBasicAuth()

public testConstructorHandlesNonBasicAuth() : mixed
Return values
mixed

testDescribesEvents()

public testDescribesEvents() : mixed
Return values
mixed

testEnsuresFileCanBeCreated()

public testEnsuresFileCanBeCreated() : mixed
Tags
expectedException

\PHPUnit_Framework_Error_Warning

Return values
mixed

testGetEventDispatcher()

public testGetEventDispatcher() : mixed
Return values
mixed

testGetResourceUri()

public testGetResourceUri() : mixed
Return values
mixed

testGetResponse()

public testGetResponse() : mixed
Return values
mixed

testHoldsCookies()

public testHoldsCookies() : mixed
Return values
mixed

testManagesQuery()

public testManagesQuery() : mixed
Return values
mixed

testPermitsFalsyComponents()

public testPermitsFalsyComponents() : mixed
Return values
mixed

testRecognizesBasicAuthCredentialsInUrls()

public testRecognizesBasicAuthCredentialsInUrls() : mixed
Return values
mixed

testRequestCanBeSentUsingCurl()

public testRequestCanBeSentUsingCurl() : mixed
Return values
mixed

testRequestCanHaveManuallySetResponseBody()

public testRequestCanHaveManuallySetResponseBody() : mixed
Return values
mixed

testRequestHandlesAuthorization()

public testRequestHandlesAuthorization() : mixed
Return values
mixed

testRequestHasHost()

public testRequestHasHost() : mixed
Return values
mixed

testRequestHasMethod()

public testRequestHasMethod() : mixed
Return values
mixed

testRequestHasMutableUrl()

public testRequestHasMutableUrl() : mixed
Return values
mixed

testRequestHasPath()

public testRequestHasPath() : mixed
Return values
mixed

testRequestHasPort()

public testRequestHasPort() : mixed
Return values
mixed

testRequestHasProtocol()

public testRequestHasProtocol() : mixed
Return values
mixed

testRequestHasScheme()

public testRequestHasScheme() : mixed
Return values
mixed

testRequestHasState()

public testRequestHasState() : mixed
Return values
mixed

testRequestsCanBeConvertedToRawMessageStrings()

public testRequestsCanBeConvertedToRawMessageStrings() : mixed
Return values
mixed

testRequestsManageClients()

public testRequestsManageClients() : mixed
Return values
mixed

testRequestsRequireClients()

public testRequestsRequireClients() : mixed
Tags
expectedException

\RuntimeException

expectedExceptionMessage

A client must be set on the request

Return values
mixed

testRequestStringsIncludeAuth()

Add authorization after the fact and see that it was put in the message

public testRequestStringsIncludeAuth() : mixed
Return values
mixed

testRequestThrowsExceptionOnBadResponse()

public testRequestThrowsExceptionOnBadResponse() : mixed
Return values
mixed

testRequestThrowsExceptionWhenSetToCompleteWithNoResponse()

public testRequestThrowsExceptionWhenSetToCompleteWithNoResponse() : mixed
Tags
expectedException

\Guzzle\Http\Exception\RequestException

expectedExceptionMessage

Error completing request

Return values
mixed

testSend()

public testSend() : mixed
Return values
mixed

testSetManualResponse()

public testSetManualResponse() : mixed
Return values
mixed

testThrowsExceptionsWhenUnsuccessfulResponseIsReceivedByDefault()

public testThrowsExceptionsWhenUnsuccessfulResponseIsReceivedByDefault() : mixed
Return values
mixed

testUnresolvedRedirectsReturnResponse()

public testUnresolvedRedirectsReturnResponse() : mixed
Return values
mixed

testUsesCustomResponseBodyWhenItIsCustom()

public testUsesCustomResponseBodyWhenItIsCustom() : mixed
Return values
mixed

testValidatesAuth()

public testValidatesAuth() : mixed
Tags
expectedException

\Guzzle\Common\Exception\InvalidArgumentException

Return values
mixed

setUp()

protected setUp() : mixed
Return values
mixed

Search results