Definition at line 50 of file Test.php.
◆ __construct()
Adapter constructor, currently empty. Config is set using setConfig()
Definition at line 85 of file Test.php.
◆ addResponse()
Add another response to the response buffer.
- Parameters
-
string | Zend_Http_Response|$response |
Definition at line 214 of file Test.php.
◆ close()
◆ connect()
connect |
( |
|
$host, |
|
|
|
$port = 80 , |
|
|
|
$secure = false |
|
) |
| |
Connect to the remote server
- Parameters
-
string | $host | |
int | $port | |
boolean | $secure | |
int | $timeout | |
- Exceptions
-
Implements Zend_Http_Client_Adapter_Interface.
Definition at line 133 of file Test.php.
135 if ($this->_nextRequestWillFail) {
136 $this->_nextRequestWillFail =
false;
137 #require_once 'Zend/Http/Client/Adapter/Exception.php';
◆ getConfig()
Retrieve the array of all configuration options
- Returns
- array
Definition at line 244 of file Test.php.
◆ read()
Return the response set in $this->setResponse()
- Returns
- string
Implements Zend_Http_Client_Adapter_Interface.
Definition at line 179 of file Test.php.
181 if ($this->responseIndex >= count($this->responses)) {
182 $this->responseIndex = 0;
184 return $this->responses[$this->responseIndex++];
◆ setConfig()
setConfig |
( |
|
$config = array() | ) |
|
Set the configuration array for the adapter
- Parameters
-
Implements Zend_Http_Client_Adapter_Interface.
Definition at line 106 of file Test.php.
112 #require_once 'Zend/Http/Client/Adapter/Exception.php'; 114 'Array or Zend_Config object expected, got ' . gettype(
$config)
118 foreach (
$config as $k => $v) {
119 $this->config[strtolower($k)] = $v;
elseif(isset( $params[ 'redirect_parent']))
◆ setNextRequestWillFail()
setNextRequestWillFail |
( |
|
$flag | ) |
|
◆ setResponse()
Set the HTTP response(s) to be returned by this adapter
- Parameters
-
Definition at line 199 of file Test.php.
206 $this->responseIndex = 0;
◆ setResponseIndex()
setResponseIndex |
( |
|
$index | ) |
|
Sets the position of the response buffer. Selects which response will be returned on the next call to read().
- Parameters
-
Definition at line 229 of file Test.php.
231 if ($index < 0 || $index >= count($this->responses)) {
232 #require_once 'Zend/Http/Client/Adapter/Exception.php'; 234 'Index out of range of response buffer size');
236 $this->responseIndex =
$index;
◆ write()
write |
( |
|
$method, |
|
|
|
$uri, |
|
|
|
$http_ver = '1.1' , |
|
|
|
$headers = array() , |
|
|
|
$body = '' |
|
) |
| |
Send request to the remote server
- Parameters
-
string | $method | |
Zend_Uri_Http | $uri | |
string | $http_ver | |
array | $headers | |
string | $body | |
- Returns
- string Request as string
Implements Zend_Http_Client_Adapter_Interface.
Definition at line 152 of file Test.php.
154 $host = $uri->getHost();
155 $host = (strtolower($uri->getScheme()) ==
'https' ?
'sslv2://' . $host : $host);
158 $path = $uri->getPath();
159 if ($uri->getQuery())
$path .=
'?' . $uri->getQuery();
160 $request =
"{$method} {$path} HTTP/{$http_ver}\r\n";
161 foreach ($headers as $k => $v) {
162 if (is_string($k)) $v = ucfirst($k) .
": $v";
◆ $_nextRequestWillFail
$_nextRequestWillFail = false |
|
protected |
◆ $config
◆ $responseIndex
◆ $responses
$responses = array("HTTP/1.1 400 Bad Request\r\n\r\n") |
|
protected |
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Http/Client/Adapter/Test.php