CollectionTest
extends GuzzleTestCase
in package
Base testcase class for all Guzzle testcases.
Tags
Table of Contents
- $mockObserver : mixed
- $server : mixed
- $serviceBuilder : mixed
- $coll : Collection
- $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
- dataProvider() : mixed
- falseyDataProvider() : mixed
- getMockedRequests() : array<string|int, mixed>
- Get all of the mocked requests
- getMockResponse() : Response
- Get a mock response for a client by mock file name
- getPathProvider() : mixed
- 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
- testAddParamsByMerging() : mixed
- testAllowsFunctionalFilter() : mixed
- testAllowsFunctionalMapping() : mixed
- testCanAddValuesToExistingKeysByUsingArray() : mixed
- testCanClearAllDataOrSpecificKeys() : mixed
- testCanGetAllValuesByArray() : mixed
- testCanReplaceAllData() : mixed
- testCanSearchByKey() : mixed
- testCanSetNestedPathValueThatDoesNotExist() : mixed
- testCanSetNestedPathValueThatExists() : mixed
- testChecksIfHasKey() : mixed
- testChecksIfHasValue() : mixed
- testConstructorCanBeCalledWithNoParams() : mixed
- testConstructorCanBeCalledWithParams() : mixed
- testFalseyKeysStillDescend() : mixed
- testGetPath() : mixed
- testGetsValuesByKey() : mixed
- testHandlesMergingInDisparateDataSources() : mixed
- testImplementsArrayAccess() : mixed
- testImplementsCount() : mixed
- testImplementsIteratorAggregate() : mixed
- testInjectsConfigData() : mixed
- testOverridesSettings() : mixed
- testOverwriteWithCollection() : mixed
- testOverwriteWithTraversable() : mixed
- testPreparesFromConfig() : mixed
- testProvidesKeys() : mixed
- testRetrievesNestedKeysUsingPath() : mixed
- testReturnsCorrectData() : mixed
- testUsesStaticWhenCreatingNew() : mixed
- testVerifiesNestedPathIsValidAtExactLevel() : mixed
- testVerifiesThatNestedPathIsValidAtAnyLevel() : mixed
- hasSubscriber() : bool
- Check if an event dispatcher has a subscriber
- setUp() : mixed
Properties
$mockObserver
public
mixed
$mockObserver
$server
public
static mixed
$server
$serviceBuilder
public
static mixed
$serviceBuilder
$coll
protected
Collection
$coll
$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
dataProvider()
public
dataProvider() : mixed
Return values
mixed —falseyDataProvider()
public
falseyDataProvider() : mixed
Return values
mixed —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 —getPathProvider()
public
getPathProvider() : mixed
Return values
mixed —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 —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 —testAddParamsByMerging()
public
testAddParamsByMerging() : mixed
Return values
mixed —testAllowsFunctionalFilter()
public
testAllowsFunctionalFilter() : mixed
Return values
mixed —testAllowsFunctionalMapping()
public
testAllowsFunctionalMapping() : mixed
Return values
mixed —testCanAddValuesToExistingKeysByUsingArray()
public
testCanAddValuesToExistingKeysByUsingArray() : mixed
Return values
mixed —testCanClearAllDataOrSpecificKeys()
public
testCanClearAllDataOrSpecificKeys() : mixed
Return values
mixed —testCanGetAllValuesByArray()
public
testCanGetAllValuesByArray() : mixed
Return values
mixed —testCanReplaceAllData()
public
testCanReplaceAllData() : mixed
Return values
mixed —testCanSearchByKey()
public
testCanSearchByKey() : mixed
Return values
mixed —testCanSetNestedPathValueThatDoesNotExist()
public
testCanSetNestedPathValueThatDoesNotExist() : mixed
Return values
mixed —testCanSetNestedPathValueThatExists()
public
testCanSetNestedPathValueThatExists() : mixed
Return values
mixed —testChecksIfHasKey()
public
testChecksIfHasKey() : mixed
Return values
mixed —testChecksIfHasValue()
public
testChecksIfHasValue() : mixed
Return values
mixed —testConstructorCanBeCalledWithNoParams()
public
testConstructorCanBeCalledWithNoParams() : mixed
Return values
mixed —testConstructorCanBeCalledWithParams()
public
testConstructorCanBeCalledWithParams() : mixed
Return values
mixed —testFalseyKeysStillDescend()
public
testFalseyKeysStillDescend() : mixed
Return values
mixed —testGetPath()
public
testGetPath(Collection $c, mixed $path, mixed $expected[, mixed $separator = '/' ]) : mixed
Parameters
- $c : Collection
- $path : mixed
- $expected : mixed
- $separator : mixed = '/'
Tags
Return values
mixed —testGetsValuesByKey()
public
testGetsValuesByKey() : mixed
Return values
mixed —testHandlesMergingInDisparateDataSources()
public
testHandlesMergingInDisparateDataSources() : mixed
Return values
mixed —testImplementsArrayAccess()
public
testImplementsArrayAccess() : mixed
Return values
mixed —testImplementsCount()
public
testImplementsCount() : mixed
Return values
mixed —testImplementsIteratorAggregate()
public
testImplementsIteratorAggregate() : mixed
Return values
mixed —testInjectsConfigData()
public
testInjectsConfigData(mixed $output, mixed $input, mixed $config) : mixed
Parameters
- $output : mixed
- $input : mixed
- $config : mixed
Tags
Return values
mixed —testOverridesSettings()
public
testOverridesSettings() : mixed
Return values
mixed —testOverwriteWithCollection()
public
testOverwriteWithCollection() : mixed
Return values
mixed —testOverwriteWithTraversable()
public
testOverwriteWithTraversable() : mixed
Return values
mixed —testPreparesFromConfig()
public
testPreparesFromConfig() : mixed
Return values
mixed —testProvidesKeys()
public
testProvidesKeys() : mixed
Return values
mixed —testRetrievesNestedKeysUsingPath()
public
testRetrievesNestedKeysUsingPath() : mixed
Return values
mixed —testReturnsCorrectData()
public
testReturnsCorrectData(mixed $a, mixed $b) : mixed
Parameters
- $a : mixed
- $b : mixed
Tags
Return values
mixed —testUsesStaticWhenCreatingNew()
public
testUsesStaticWhenCreatingNew() : mixed
Return values
mixed —testVerifiesNestedPathIsValidAtExactLevel()
public
testVerifiesNestedPathIsValidAtExactLevel() : mixed
Tags
Return values
mixed —testVerifiesThatNestedPathIsValidAtAnyLevel()
public
testVerifiesThatNestedPathIsValidAtAnyLevel() : 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
Return values
bool —setUp()
protected
setUp() : mixed