\Guzzle\Tests\MessageResponseTest

Base testcase class for all Guzzle testcases.

Summary

Methods
Properties
Constants
getServer()
setServiceBuilder()
getServiceBuilder()
getWildcardObserver()
setMockBasePath()
addMockedRequest()
getMockedRequests()
getMockResponse()
setMockResponse()
compareHeaders()
assertContainsIns()
setup()
tearDown()
testConstructor()
test__toString()
testFactory()
testFactoryCanCreateHeadResponses()
testFactoryRequiresMessage()
testGetBody()
testManagesStatusCode()
testGetMessage()
testGetRawHeaders()
testHandlesStatusAndStatusCodes()
testIsClientError()
testIsError()
testIsInformational()
testIsRedirect()
testIsServerError()
testIsSuccessful()
testGetAcceptRanges()
testCalculatesAge()
testGetAllow()
testGetCacheControl()
testGetContentEncoding()
testGetContentLanguage()
testGetContentLength()
testGetContentLocation()
testGetContentDisposition()
testGetContentMd5()
testGetContentRange()
testGetContentType()
testGetDate()
testGetEtag()
testGetExpires()
testGetLastModified()
testGetLocation()
testGetPragma()
testGetProxyAuthenticate()
testGetServer()
testGetSetCookie()
testGetMultipleSetCookie()
testGetSetCookieNormalizesHeaders()
testGetTrailer()
testGetTransferEncoding()
testGetVary()
testReturnsViaHeader()
testGetWarning()
testReturnsWwwAuthenticateHeader()
testReturnsConnectionHeader()
testReturnsHeaders()
testHasTransferInfo()
testDeterminesIfItCanBeCached()
testDeterminesResponseMaxAge()
testDeterminesIfItCanValidate()
testCalculatesFreshness()
testHandlesProtocols()
testComparesContentType()
testResponseDeterminesIfMethodIsAllowedBaseOnAllowHeader()
testParsesJsonResponses()
testThrowsExceptionWhenFailsToParseJsonResponse()
testParsesXmlResponses()
testThrowsExceptionWhenFailsToParseXmlResponse()
testResponseIsSerializable()
testPreventsComplexExternalEntities()
$serviceBuilder
$server
$mockObserver
No constants found
hasSubscriber()
$mockBasePath
$response
N/A
getResponse()
$requests
N/A

Properties

$serviceBuilder

$serviceBuilder : 

Type

$server

$server : 

Type

$mockObserver

$mockObserver : 

Type

$mockBasePath

$mockBasePath : 

Type

$requests

$requests : 

Type

Methods

getServer()

getServer() : \Guzzle\Tests\Http\Server

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

Returns

\Guzzle\Tests\Http\Server

getServiceBuilder()

getServiceBuilder() : \Guzzle\Service\Builder\ServiceBuilder

Get a service builder object that can be used throughout the service tests

Returns

\Guzzle\Service\Builder\ServiceBuilder

setMockBasePath()

setMockBasePath(string  $path) : \Guzzle\Tests\GuzzleTestCase

Set the mock response base path

Parameters

string $path

Path to mock response folder

Returns

\Guzzle\Tests\GuzzleTestCase

addMockedRequest()

addMockedRequest(\Guzzle\Http\Message\RequestInterface  $request) : self

Mark a request as being mocked

Parameters

\Guzzle\Http\Message\RequestInterface $request

Returns

self

getMockedRequests()

getMockedRequests() : array

Get all of the mocked requests

Returns

array

getMockResponse()

getMockResponse(string  $path) : \Guzzle\Http\Message\Response

Get a mock response for a client by mock file name

Parameters

string $path

Relative path to the mock response file

Returns

\Guzzle\Http\Message\Response

setMockResponse()

setMockResponse(\Guzzle\Http\Client  $client, string  $paths) : \Guzzle\Plugin\Mock\MockPlugin

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

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

\Guzzle\Http\Client $client

Client object to modify

string $paths

Path to files within the Mock folder of the service

Returns

\Guzzle\Plugin\Mock\MockPlugin

returns the created mock plugin

compareHeaders()

compareHeaders(array  $filteredHeaders, array  $actualHeaders) : array|boolean

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

Parameters

array $filteredHeaders

Array of special headers

array $actualHeaders

Array of headers to check against

Returns

array|boolean —

Returns an array of the differences or FALSE if none

assertContainsIns()

assertContainsIns(string  $needle, string  $haystack, string  $message = null) 

Case insensitive assertContains

Parameters

string $needle

Search string

string $haystack

Search this

string $message

Optional failure message

setup()

setup() 

tearDown()

tearDown() 

testConstructor()

testConstructor() 

test__toString()

test__toString() 

testFactory()

testFactory() 

testFactoryCanCreateHeadResponses()

testFactoryCanCreateHeadResponses() 

testFactoryRequiresMessage()

testFactoryRequiresMessage() 

testGetBody()

testGetBody() 

testManagesStatusCode()

testManagesStatusCode() 

testGetMessage()

testGetMessage() 

testGetRawHeaders()

testGetRawHeaders() 

testHandlesStatusAndStatusCodes()

testHandlesStatusAndStatusCodes() 

testIsClientError()

testIsClientError() 

testIsError()

testIsError() 

testIsInformational()

testIsInformational() 

testIsRedirect()

testIsRedirect() 

testIsServerError()

testIsServerError() 

testIsSuccessful()

testIsSuccessful() 

testGetAcceptRanges()

testGetAcceptRanges() 

testCalculatesAge()

testCalculatesAge() 

testGetAllow()

testGetAllow() 

testGetCacheControl()

testGetCacheControl() 

testGetContentEncoding()

testGetContentEncoding() 

testGetContentLanguage()

testGetContentLanguage() 

testGetContentLength()

testGetContentLength() 

testGetContentLocation()

testGetContentLocation() 

testGetContentDisposition()

testGetContentDisposition() 

testGetContentMd5()

testGetContentMd5() 

testGetContentRange()

testGetContentRange() 

testGetContentType()

testGetContentType() 

testGetDate()

testGetDate() 

testGetEtag()

testGetEtag() 

testGetExpires()

testGetExpires() 

testGetLastModified()

testGetLastModified() 

testGetLocation()

testGetLocation() 

testGetPragma()

testGetPragma() 

testGetProxyAuthenticate()

testGetProxyAuthenticate() 

testGetServer()

testGetServer() 

testGetSetCookie()

testGetSetCookie() 

testGetMultipleSetCookie()

testGetMultipleSetCookie() 

testGetSetCookieNormalizesHeaders()

testGetSetCookieNormalizesHeaders() 

testGetTrailer()

testGetTrailer() 

testGetTransferEncoding()

testGetTransferEncoding() 

testGetVary()

testGetVary() 

testReturnsViaHeader()

testReturnsViaHeader() 

testGetWarning()

testGetWarning() 

testReturnsWwwAuthenticateHeader()

testReturnsWwwAuthenticateHeader() 

testReturnsConnectionHeader()

testReturnsConnectionHeader() 

testReturnsHeaders()

testReturnsHeaders() 

testHasTransferInfo()

testHasTransferInfo() 

testDeterminesIfItCanBeCached()

testDeterminesIfItCanBeCached() 

testDeterminesResponseMaxAge()

testDeterminesResponseMaxAge() 

testDeterminesIfItCanValidate()

testDeterminesIfItCanValidate() 

testCalculatesFreshness()

testCalculatesFreshness() 

testHandlesProtocols()

testHandlesProtocols() 

testComparesContentType()

testComparesContentType() 

testResponseDeterminesIfMethodIsAllowedBaseOnAllowHeader()

testResponseDeterminesIfMethodIsAllowedBaseOnAllowHeader() 

testParsesJsonResponses()

testParsesJsonResponses() 

testThrowsExceptionWhenFailsToParseJsonResponse()

testThrowsExceptionWhenFailsToParseJsonResponse() 

testParsesXmlResponses()

testParsesXmlResponses() 

testThrowsExceptionWhenFailsToParseXmlResponse()

testThrowsExceptionWhenFailsToParseXmlResponse() 

testResponseIsSerializable()

testResponseIsSerializable() 

testPreventsComplexExternalEntities()

testPreventsComplexExternalEntities()