Documentation

ClientTest extends GuzzleTestCase
in package

Base testcase class for all Guzzle testcases.

Tags
group

server

covers

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
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
testAcceptsConfig()  : mixed
testAllowsConfigsToBeChangedAndInjectedInBaseUrl()  : mixed
testAllowsCustomCurlMultiObjects()  : mixed
testAllowsCustomVariablesWhenExpandingTemplates()  : mixed
testAllowsDefaultHeaders()  : mixed
testAllowsEmptyBaseUrl()  : mixed
testAllowsUriTemplateInjection()  : mixed
testBuildsRelativeUrls()  : mixed
testCanSetDefaultRequestOptions()  : mixed
testCanSetRelativeUrlStartingWithHttp()  : mixed
testCanSetSetOptionsOnRequests()  : mixed
testCanUseCollectionAsConfig()  : mixed
testClientAddsCurlOptionsToRequests()  : mixed
testClientAddsParamsToRequests()  : mixed
testClientAllowsFineGrainedSslControlButIsSecureByDefault()  : mixed
testClientAllowsSettingSpecificSslCaInfo()  : mixed
testClientAllowsUnsafeOperationIfRequested()  : mixed
testClientAttachersObserversToRequests()  : mixed
testClientHasHelperMethodsForCreatingRequests()  : mixed
testClientInjectsConfigsIntoUrls()  : mixed
testClientPreventsInadvertentInsecureVerifyHostSetting()  : mixed
testClientPreventsInvalidVerifyPeerSetting()  : mixed
testClientReturnsValidBaseUrls()  : mixed
testClientSendsMultipleRequests()  : mixed
testClientSendsSingleRequest()  : mixed
testClientThrowsExceptionForMultipleRequests()  : mixed
testClientThrowsExceptionForSingleRequest()  : mixed
testConfigSettingsControlSslConfiguration()  : mixed
testConstructorCanAcceptConfig()  : mixed
testCreatesRequestsWithDefaultValues()  : mixed
testDescribesEvents()  : mixed
testDontReuseCurlMulti()  : mixed
testExpandsUriTemplatesUsingConfig()  : mixed
testGetDefaultUserAgent()  : mixed
testHasDefaultOptionsHelperMethods()  : mixed
testHeadCanUseOptions()  : mixed
testOverwritesUserAgent()  : mixed
testQueryStringsAreNotDoubleEncoded()  : mixed
testQueryStringsAreNotDoubleEncodedUsingAbsolutePaths()  : mixed
testThrowsExceptionForInvalidCertificate()  : mixed
testUriArrayAllowsCustomTemplateVariables()  : mixed
testUsesDefaultUserAgent()  : mixed
urlProvider()  : mixed
hasSubscriber()  : bool
Check if an event dispatcher has a subscriber
getLogPlugin()  : LogPlugin

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

testAcceptsConfig()

public testAcceptsConfig() : mixed
Return values
mixed

testAllowsConfigsToBeChangedAndInjectedInBaseUrl()

public testAllowsConfigsToBeChangedAndInjectedInBaseUrl() : mixed
Return values
mixed

testAllowsCustomCurlMultiObjects()

public testAllowsCustomCurlMultiObjects() : mixed
Return values
mixed

testAllowsCustomVariablesWhenExpandingTemplates()

public testAllowsCustomVariablesWhenExpandingTemplates() : mixed
Return values
mixed

testAllowsDefaultHeaders()

public testAllowsDefaultHeaders() : mixed
Return values
mixed

testAllowsEmptyBaseUrl()

public testAllowsEmptyBaseUrl() : mixed
Return values
mixed

testAllowsUriTemplateInjection()

public testAllowsUriTemplateInjection() : mixed
Return values
mixed

testBuildsRelativeUrls()

public testBuildsRelativeUrls(mixed $baseUrl, mixed $url, mixed $result) : mixed
Parameters
$baseUrl : mixed
$url : mixed
$result : mixed
Tags
dataProvider

urlProvider

Return values
mixed

testCanSetDefaultRequestOptions()

public testCanSetDefaultRequestOptions() : mixed
Return values
mixed

testCanSetRelativeUrlStartingWithHttp()

public testCanSetRelativeUrlStartingWithHttp() : mixed
Return values
mixed

testCanSetSetOptionsOnRequests()

public testCanSetSetOptionsOnRequests() : mixed
Return values
mixed

testCanUseCollectionAsConfig()

public testCanUseCollectionAsConfig() : mixed
Return values
mixed

testClientAddsCurlOptionsToRequests()

public testClientAddsCurlOptionsToRequests() : mixed
Return values
mixed

testClientAddsParamsToRequests()

public testClientAddsParamsToRequests() : mixed
Return values
mixed

testClientAllowsFineGrainedSslControlButIsSecureByDefault()

public testClientAllowsFineGrainedSslControlButIsSecureByDefault() : mixed
Return values
mixed

testClientAllowsSettingSpecificSslCaInfo()

public testClientAllowsSettingSpecificSslCaInfo() : mixed
Return values
mixed

testClientAllowsUnsafeOperationIfRequested()

public testClientAllowsUnsafeOperationIfRequested() : mixed
Return values
mixed

testClientAttachersObserversToRequests()

public testClientAttachersObserversToRequests() : mixed
Return values
mixed

testClientHasHelperMethodsForCreatingRequests()

public testClientHasHelperMethodsForCreatingRequests() : mixed
Return values
mixed

testClientInjectsConfigsIntoUrls()

public testClientInjectsConfigsIntoUrls() : mixed
Return values
mixed

testClientPreventsInadvertentInsecureVerifyHostSetting()

public testClientPreventsInadvertentInsecureVerifyHostSetting() : mixed
Tags
expectedException

Guzzle\Common\Exception\InvalidArgumentException

Return values
mixed

testClientPreventsInvalidVerifyPeerSetting()

public testClientPreventsInvalidVerifyPeerSetting() : mixed
Tags
expectedException

Guzzle\Common\Exception\InvalidArgumentException

Return values
mixed

testClientReturnsValidBaseUrls()

public testClientReturnsValidBaseUrls() : mixed
Return values
mixed

testClientSendsMultipleRequests()

public testClientSendsMultipleRequests() : mixed
Return values
mixed

testClientSendsSingleRequest()

public testClientSendsSingleRequest() : mixed
Return values
mixed

testClientThrowsExceptionForMultipleRequests()

public testClientThrowsExceptionForMultipleRequests() : mixed
Tags
expectedException

\Guzzle\Common\Exception\ExceptionCollection

Return values
mixed

testClientThrowsExceptionForSingleRequest()

public testClientThrowsExceptionForSingleRequest() : mixed
Tags
expectedException

\Guzzle\Http\Exception\BadResponseException

Return values
mixed

testConfigSettingsControlSslConfiguration()

public testConfigSettingsControlSslConfiguration() : mixed
Return values
mixed

testConstructorCanAcceptConfig()

public testConstructorCanAcceptConfig() : mixed
Return values
mixed

testCreatesRequestsWithDefaultValues()

public testCreatesRequestsWithDefaultValues() : mixed
Return values
mixed

testDescribesEvents()

public testDescribesEvents() : mixed
Return values
mixed

testDontReuseCurlMulti()

public testDontReuseCurlMulti() : mixed
Return values
mixed

testExpandsUriTemplatesUsingConfig()

public testExpandsUriTemplatesUsingConfig() : mixed
Return values
mixed

testGetDefaultUserAgent()

public testGetDefaultUserAgent() : mixed
Return values
mixed

testHasDefaultOptionsHelperMethods()

public testHasDefaultOptionsHelperMethods() : mixed
Return values
mixed

testHeadCanUseOptions()

public testHeadCanUseOptions() : mixed
Return values
mixed

testOverwritesUserAgent()

public testOverwritesUserAgent() : mixed
Return values
mixed

testQueryStringsAreNotDoubleEncoded()

public testQueryStringsAreNotDoubleEncoded() : mixed
Return values
mixed

testQueryStringsAreNotDoubleEncodedUsingAbsolutePaths()

public testQueryStringsAreNotDoubleEncodedUsingAbsolutePaths() : mixed
Return values
mixed

testThrowsExceptionForInvalidCertificate()

public testThrowsExceptionForInvalidCertificate() : mixed
Tags
expectedException

\Guzzle\Common\Exception\RuntimeException

Return values
mixed

testUriArrayAllowsCustomTemplateVariables()

public testUriArrayAllowsCustomTemplateVariables() : mixed
Return values
mixed

testUsesDefaultUserAgent()

public testUsesDefaultUserAgent() : mixed
Return values
mixed

urlProvider()

public urlProvider() : mixed
Return values
mixed

Search results