ParameterTest
extends GuzzleTestCase
in package
Base testcase class for all Guzzle testcases.
Tags
Table of Contents
- $mockObserver : mixed
- $server : mixed
- $serviceBuilder : mixed
- $data : 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
- dateTimeProvider() : 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
- 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
- testAddsAdditionalProperties() : mixed
- testAddsItems() : mixed
- testAllowsComplexFilters() : mixed
- testAllowsNestedShape() : mixed
- testAllowsSimpleLocationValue() : mixed
- testAppliesFormat() : mixed
- testCanBuildUpParams() : mixed
- testCanChangeParentOfNestedParameter() : mixed
- testCanConvertToArray() : mixed
- testCanRemoveFromNestedStructure() : mixed
- testCanRetrieveKnownPropertiesUsingDataMethod() : mixed
- testConvertsBooleans() : mixed
- testCreatesParamFromArray() : mixed
- testFiltersValues() : mixed
- testHasEnum() : mixed
- testHasExtraProperties() : mixed
- testHasInstanceOf() : mixed
- testHasKeyMethod() : mixed
- testHasPattern() : mixed
- testIncludesNameInToArrayWhenItemsAttributeHasName() : mixed
- testParsesTypeValues() : mixed
- testResolvesExtendsRecursively() : mixed
- testResolvesRefKeysRecursively() : mixed
- testReturnsYourValue() : mixed
- testSerializesItems() : mixed
- testUsesArrayByDefaultForFilters() : mixed
- testUsesDefault() : mixed
- testUsesStatic() : mixed
- testValidatesComplexFilters() : mixed
- testZeroValueDoesNotCauseDefaultToBeReturned() : mixed
- hasSubscriber() : bool
- Check if an event dispatcher has a subscriber
Properties
$mockObserver
public
mixed
$mockObserver
$server
public
static mixed
$server
$serviceBuilder
public
static mixed
$serviceBuilder
$data
protected
mixed
$data
= array('name' => 'foo', 'type' => 'bar', 'required' => true, 'default' => '123', 'description' => '456', 'minLength' => 2, 'maxLength' => 5, 'location' => 'body', 'static' => 'static!', 'filters' => array('trim', 'json_encode'))
$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
dateTimeProvider()
public
dateTimeProvider() : 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 —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 —testAddsAdditionalProperties()
public
testAddsAdditionalProperties() : mixed
Return values
mixed —testAddsItems()
public
testAddsItems() : mixed
Return values
mixed —testAllowsComplexFilters()
public
testAllowsComplexFilters() : mixed
Return values
mixed —testAllowsNestedShape()
public
testAllowsNestedShape() : mixed
Return values
mixed —testAllowsSimpleLocationValue()
public
testAllowsSimpleLocationValue() : mixed
Return values
mixed —testAppliesFormat()
public
testAppliesFormat(mixed $d, mixed $format, mixed $result) : mixed
Parameters
- $d : mixed
- $format : mixed
- $result : mixed
Tags
Return values
mixed —testCanBuildUpParams()
public
testCanBuildUpParams() : mixed
Return values
mixed —testCanChangeParentOfNestedParameter()
public
testCanChangeParentOfNestedParameter() : mixed
Return values
mixed —testCanConvertToArray()
public
testCanConvertToArray() : mixed
Return values
mixed —testCanRemoveFromNestedStructure()
public
testCanRemoveFromNestedStructure() : mixed
Return values
mixed —testCanRetrieveKnownPropertiesUsingDataMethod()
public
testCanRetrieveKnownPropertiesUsingDataMethod() : mixed
Return values
mixed —testConvertsBooleans()
public
testConvertsBooleans() : mixed
Return values
mixed —testCreatesParamFromArray()
public
testCreatesParamFromArray() : mixed
Return values
mixed —testFiltersValues()
public
testFiltersValues() : mixed
Return values
mixed —testHasEnum()
public
testHasEnum() : mixed
Return values
mixed —testHasExtraProperties()
public
testHasExtraProperties() : mixed
Return values
mixed —testHasInstanceOf()
public
testHasInstanceOf() : mixed
Return values
mixed —testHasKeyMethod()
public
testHasKeyMethod() : mixed
Return values
mixed —testHasPattern()
public
testHasPattern() : mixed
Return values
mixed —testIncludesNameInToArrayWhenItemsAttributeHasName()
public
testIncludesNameInToArrayWhenItemsAttributeHasName() : mixed
Return values
mixed —testParsesTypeValues()
public
testParsesTypeValues() : mixed
Return values
mixed —testResolvesExtendsRecursively()
public
testResolvesExtendsRecursively() : mixed
Return values
mixed —testResolvesRefKeysRecursively()
public
testResolvesRefKeysRecursively() : mixed
Return values
mixed —testReturnsYourValue()
public
testReturnsYourValue() : mixed
Return values
mixed —testSerializesItems()
public
testSerializesItems() : mixed
Return values
mixed —testUsesArrayByDefaultForFilters()
public
testUsesArrayByDefaultForFilters() : mixed
Return values
mixed —testUsesDefault()
public
testUsesDefault() : mixed
Return values
mixed —testUsesStatic()
public
testUsesStatic() : mixed
Return values
mixed —testValidatesComplexFilters()
public
testValidatesComplexFilters() : mixed
Tags
Return values
mixed —testZeroValueDoesNotCauseDefaultToBeReturned()
public
testZeroValueDoesNotCauseDefaultToBeReturned() : mixed
Return values
mixed —hasSubscriber()
Check if an event dispatcher has a subscriber
protected
hasSubscriber(HasDispatcherInterface $dispatcher, EventSubscriberInterface $subscriber) : bool
Parameters
- $dispatcher : HasDispatcherInterface
- $subscriber : EventSubscriberInterface