__construct()
addResponse()
close()
connect()
read()
setNextRequestWillFail()
setOptions()
setResponse()
setResponseIndex()
write()
$config
$nextRequestWillFail
$responseIndex
$responses
A testing-purposes adapter.
Should be used to test all components that rely on Zend\Http\Client, without actually performing an HTTP request. You should instantiate this object manually, and then set it as the client's adapter. Then, you can set the expected response using the setResponse() method.
__construct()
Config is set using setOptions()
addResponse(string | \Zend\Http\Response $response)
string\Zend\Http\Response
close()
connect(string $host, int $port, bool $secure)
string
int
bool
\Zend\Http\Client\Adapter\Exception\RuntimeException |
---|
read() : string
string
setNextRequestWillFail(bool $flag) : \Zend\Http\Client\Adapter\Test
setOptions(array | \Traversable $options)
array\Traversable
\Zend\Http\Client\Adapter\Exception\InvalidArgumentException |
---|
setResponse(\Zend\Http\Response | array | string $response)
\Zend\Http\Responsearraystring
setResponseIndex(int $index)
Selects which response will be returned on the next call to read().
int
\Zend\Http\Client\Adapter\Exception\OutOfRangeException |
---|
write(string $method, \Zend\Uri\Uri $uri, string $httpVer, array $headers, string $body) : string
string
\Zend\Uri\Uri
string
array
string
string
Request as string$config : array
$nextRequestWillFail : bool
$responseIndex : int
$responses : array
Can be set using setResponse() and addResponse().