Documentation

CommandTest extends AbstractCommandTest
in package

Base testcase class for all Guzzle testcases.

Tags
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
testAddsCurlOptionsToRequestsWhenPreparing()  : mixed
testAllowsValidatorToBeInjected()  : mixed
testCanAccessValidationErrorsFromCommand()  : mixed
testCanChangeResponseBody()  : mixed
testCanDisableValidation()  : mixed
testCanInitConfig()  : mixed
testCanSetResultManually()  : mixed
testCloneMakesNewRequest()  : mixed
testCommandsAllowsCustomRequestHeaders()  : mixed
testCommandsAllowsCustomRequestHeadersAsArray()  : mixed
testCommandsUsesOperation()  : mixed
testConstructorAddsDefaultParams()  : mixed
testConvertsInvalidJsonResponsesToArray()  : mixed
testConvertsJsonResponsesToArray()  : mixed
testCreatesDefaultOperation()  : mixed
testDeterminesShortName()  : mixed
testExecute()  : mixed
testExecuteThrowsExceptionWhenNoClientIsSet()  : mixed
testGetRequestThrowsExceptionBeforePreparation()  : mixed
testGetResponseExecutesCommandsWhenNeeded()  : mixed
testGetResultExecutesCommandsWhenNeeded()  : mixed
testHasOnCompleteMethod()  : mixed
testIsInvokable()  : mixed
testOnCompleteMustBeCallable()  : mixed
testPrepareThrowsExceptionWhenNoClientIsSet()  : mixed
testProcessResponseIsNotXml()  : mixed
testSetClient()  : mixed
testValidatesAdditionalParameters()  : mixed
testValidatesCommandBeforeSending()  : mixed
testValidatorDoesNotUpdateNonDefaultValues()  : mixed
testValidatorUpdatesDefaultValues()  : mixed
getClient()  : mixed
hasSubscriber()  : bool
Check if an event dispatcher has a subscriber
getOperation()  : 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

testAddsCurlOptionsToRequestsWhenPreparing()

public testAddsCurlOptionsToRequestsWhenPreparing() : mixed
Return values
mixed

testAllowsValidatorToBeInjected()

public testAllowsValidatorToBeInjected() : mixed
Return values
mixed

testCanAccessValidationErrorsFromCommand()

public testCanAccessValidationErrorsFromCommand() : mixed
Return values
mixed

testCanChangeResponseBody()

public testCanChangeResponseBody() : mixed
Return values
mixed

testCanDisableValidation()

public testCanDisableValidation() : mixed
Return values
mixed

testCanInitConfig()

public testCanInitConfig() : mixed
Return values
mixed

testCanSetResultManually()

public testCanSetResultManually() : mixed
Return values
mixed

testCloneMakesNewRequest()

public testCloneMakesNewRequest() : mixed
Return values
mixed

testCommandsAllowsCustomRequestHeaders()

public testCommandsAllowsCustomRequestHeaders() : mixed
Return values
mixed

testCommandsAllowsCustomRequestHeadersAsArray()

public testCommandsAllowsCustomRequestHeadersAsArray() : mixed
Return values
mixed

testCommandsUsesOperation()

public testCommandsUsesOperation() : mixed
Return values
mixed

testConstructorAddsDefaultParams()

public testConstructorAddsDefaultParams() : mixed
Return values
mixed

testConvertsInvalidJsonResponsesToArray()

public testConvertsInvalidJsonResponsesToArray() : mixed
Tags
expectedException

\Guzzle\Common\Exception\RuntimeException

Return values
mixed

testConvertsJsonResponsesToArray()

public testConvertsJsonResponsesToArray() : mixed
Return values
mixed

testCreatesDefaultOperation()

public testCreatesDefaultOperation() : mixed
Return values
mixed

testDeterminesShortName()

public testDeterminesShortName() : mixed
Return values
mixed

testExecute()

public testExecute() : mixed
Return values
mixed

testExecuteThrowsExceptionWhenNoClientIsSet()

public testExecuteThrowsExceptionWhenNoClientIsSet() : mixed
Tags
expectedException

RuntimeException

Return values
mixed

testGetRequestThrowsExceptionBeforePreparation()

public testGetRequestThrowsExceptionBeforePreparation() : mixed
Tags
expectedException

RuntimeException

Return values
mixed

testGetResponseExecutesCommandsWhenNeeded()

public testGetResponseExecutesCommandsWhenNeeded() : mixed
Return values
mixed

testGetResultExecutesCommandsWhenNeeded()

public testGetResultExecutesCommandsWhenNeeded() : mixed
Return values
mixed

testHasOnCompleteMethod()

public testHasOnCompleteMethod() : mixed
Return values
mixed

testIsInvokable()

public testIsInvokable() : mixed
Return values
mixed

testOnCompleteMustBeCallable()

public testOnCompleteMustBeCallable() : mixed
Tags
expectedException

\Guzzle\Common\Exception\InvalidArgumentException

Return values
mixed

testPrepareThrowsExceptionWhenNoClientIsSet()

public testPrepareThrowsExceptionWhenNoClientIsSet() : mixed
Tags
expectedException

RuntimeException

Return values
mixed

testProcessResponseIsNotXml()

public testProcessResponseIsNotXml() : mixed
Return values
mixed

testSetClient()

public testSetClient() : mixed
Return values
mixed

testValidatesAdditionalParameters()

public testValidatesAdditionalParameters() : mixed
Tags
expectedException

\Guzzle\Service\Exception\ValidationException

expectedExceptionMessage

Validation errors: [abc] must be of type string

Return values
mixed

testValidatesCommandBeforeSending()

public testValidatesCommandBeforeSending() : mixed
Tags
expectedException

\Guzzle\Service\Exception\ValidationException

expectedExceptionMessage

[Foo] Baz

Return values
mixed

testValidatorDoesNotUpdateNonDefaultValues()

public testValidatorDoesNotUpdateNonDefaultValues() : mixed
Return values
mixed

testValidatorUpdatesDefaultValues()

public testValidatorUpdatesDefaultValues() : mixed
Return values
mixed

getOperation()

private getOperation() : mixed
Return values
mixed

Search results