CurlHandleTest
extends GuzzleTestCase
in package
Base testcase class for all Guzzle testcases.
Tags
Table of Contents
- $mockObserver : mixed
- $requestHandle : 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
- dataProvider() : array<string|int, mixed>
- Data provider for factory tests
- 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
- provideCurlConfig() : array<string|int, mixed>
- Data provider for curl configurations
- requestMethodProvider() : mixed
- 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
- setUp() : mixed
- testAccountsForMissingStdErr() : mixed
- testAddsCustomCurlOptions() : mixed
- testAllowsCurloptEncodingToBeSet() : mixed
- testAllowsWireTransferInfoToBeEnabled() : mixed
- testCanSendBodyAsString() : mixed
- testCanSendPostBodyAsString() : mixed
- testConstructorExpectsCurlResource() : mixed
- testConstructorExpectsProperOptions() : mixed
- testConstructorInitializesObject() : mixed
- testCurlConfigurationOptionsAreSet() : mixed
- testDeterminesIfResourceIsAvailable() : mixed
- testEnsuresRequestsHaveResponsesWhenUpdatingFromTransfer() : mixed
- testFactoryCreatesCurlBasedOnRequest() : mixed
- testFactoryUsesSpecifiedProtocol() : mixed
- testGetInfoWithoutDebugMode() : mixed
- testParseCurlConfigConvertsStringKeysToConstantKeys() : mixed
- testSeeksToBeginningOfStreamWhenSending() : mixed
- testSendsExpectHeaderWhenSizeIsGreaterThanCutoff() : mixed
- testSendsPostFieldsForNonPostRequests() : mixed
- testSendsPostFilesForNonPostRequests() : mixed
- testSendsPostRequestsWithFields() : mixed
- testSendsPostRequestsWithFiles() : mixed
- testSendsPostUploadsWithContentDispositionHeaders() : mixed
- testSendsRequestsWithNoBodyUsingContentLengthZero() : mixed
- testSetsCurloptEncodingWhenAcceptEncodingHeaderIsSet() : mixed
- testStoresCurlErrorNumber() : mixed
- testStoresStdErr() : mixed
- testUploadsPutData() : mixed
- testUploadsPutDataUsingChunkedEncodingWhenForced() : mixed
- testUploadsPutDataUsingChunkedEncodingWhenLengthCannotBeDetermined() : mixed
- testWrapsCurlOptions() : mixed
- testWrapsErrorsAndInfo() : mixed
- hasSubscriber() : bool
- Check if an event dispatcher has a subscriber
- updateForHandle() : mixed
Properties
$mockObserver
public
mixed
$mockObserver
$requestHandle
public
mixed
$requestHandle
$server
public
static mixed
$server
$serviceBuilder
public
static mixed
$serviceBuilder
$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()
Data provider for factory tests
public
dataProvider() : array<string|int, mixed>
Return values
array<string|int, 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 —provideCurlConfig()
Data provider for curl configurations
public
provideCurlConfig() : array<string|int, mixed>
Return values
array<string|int, mixed> —requestMethodProvider()
public
requestMethodProvider() : mixed
Return values
mixed —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 —setUp()
public
setUp() : mixed
Return values
mixed —testAccountsForMissingStdErr()
public
testAccountsForMissingStdErr() : mixed
Return values
mixed —testAddsCustomCurlOptions()
public
testAddsCustomCurlOptions() : mixed
Return values
mixed —testAllowsCurloptEncodingToBeSet()
public
testAllowsCurloptEncodingToBeSet() : mixed
Return values
mixed —testAllowsWireTransferInfoToBeEnabled()
public
testAllowsWireTransferInfoToBeEnabled() : mixed
Return values
mixed —testCanSendBodyAsString()
public
testCanSendBodyAsString() : mixed
Return values
mixed —testCanSendPostBodyAsString()
public
testCanSendPostBodyAsString() : mixed
Return values
mixed —testConstructorExpectsCurlResource()
public
testConstructorExpectsCurlResource() : mixed
Tags
Return values
mixed —testConstructorExpectsProperOptions()
public
testConstructorExpectsProperOptions() : mixed
Return values
mixed —testConstructorInitializesObject()
public
testConstructorInitializesObject() : mixed
Return values
mixed —testCurlConfigurationOptionsAreSet()
public
testCurlConfigurationOptionsAreSet() : mixed
Return values
mixed —testDeterminesIfResourceIsAvailable()
public
testDeterminesIfResourceIsAvailable() : mixed
Return values
mixed —testEnsuresRequestsHaveResponsesWhenUpdatingFromTransfer()
public
testEnsuresRequestsHaveResponsesWhenUpdatingFromTransfer() : mixed
Return values
mixed —testFactoryCreatesCurlBasedOnRequest()
public
testFactoryCreatesCurlBasedOnRequest(mixed $method, mixed $url, mixed $headers, mixed $body, mixed $options[, mixed $expectedHeaders = null ]) : mixed
Parameters
- $method : mixed
- $url : mixed
- $headers : mixed
- $body : mixed
- $options : mixed
- $expectedHeaders : mixed = null
Tags
Return values
mixed —testFactoryUsesSpecifiedProtocol()
public
testFactoryUsesSpecifiedProtocol() : mixed
Return values
mixed —testGetInfoWithoutDebugMode()
public
testGetInfoWithoutDebugMode() : mixed
Return values
mixed —testParseCurlConfigConvertsStringKeysToConstantKeys()
public
testParseCurlConfigConvertsStringKeysToConstantKeys(mixed $options, mixed $expected) : mixed
Parameters
- $options : mixed
- $expected : mixed
Tags
Return values
mixed —testSeeksToBeginningOfStreamWhenSending()
public
testSeeksToBeginningOfStreamWhenSending() : mixed
Return values
mixed —testSendsExpectHeaderWhenSizeIsGreaterThanCutoff()
public
testSendsExpectHeaderWhenSizeIsGreaterThanCutoff() : mixed
Return values
mixed —testSendsPostFieldsForNonPostRequests()
public
testSendsPostFieldsForNonPostRequests() : mixed
Return values
mixed —testSendsPostFilesForNonPostRequests()
public
testSendsPostFilesForNonPostRequests() : mixed
Return values
mixed —testSendsPostRequestsWithFields()
public
testSendsPostRequestsWithFields() : mixed
Return values
mixed —testSendsPostRequestsWithFiles()
public
testSendsPostRequestsWithFiles() : mixed
Return values
mixed —testSendsPostUploadsWithContentDispositionHeaders()
public
testSendsPostUploadsWithContentDispositionHeaders() : mixed
Return values
mixed —testSendsRequestsWithNoBodyUsingContentLengthZero()
public
testSendsRequestsWithNoBodyUsingContentLengthZero(mixed $method) : mixed
Parameters
- $method : mixed
Tags
Return values
mixed —testSetsCurloptEncodingWhenAcceptEncodingHeaderIsSet()
public
testSetsCurloptEncodingWhenAcceptEncodingHeaderIsSet() : mixed
Return values
mixed —testStoresCurlErrorNumber()
public
testStoresCurlErrorNumber() : mixed
Return values
mixed —testStoresStdErr()
public
testStoresStdErr() : mixed
Return values
mixed —testUploadsPutData()
public
testUploadsPutData() : mixed
Return values
mixed —testUploadsPutDataUsingChunkedEncodingWhenForced()
public
testUploadsPutDataUsingChunkedEncodingWhenForced() : mixed
Return values
mixed —testUploadsPutDataUsingChunkedEncodingWhenLengthCannotBeDetermined()
public
testUploadsPutDataUsingChunkedEncodingWhenLengthCannotBeDetermined() : mixed
Return values
mixed —testWrapsCurlOptions()
public
testWrapsCurlOptions() : mixed
Return values
mixed —testWrapsErrorsAndInfo()
public
testWrapsErrorsAndInfo() : 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
Return values
bool —updateForHandle()
protected
updateForHandle(RequestInterface $request) : mixed
Parameters
- $request : RequestInterface