Пример #1
0
 /**
  * Test that responses could be added as objects (ZF-7009)
  *
  * @link http://framework.zend.com/issues/browse/ZF-7009
  * @dataProvider validHttpResponseProvider
  */
 public function testAddResponseAsObject($testResponse)
 {
     $this->adapter->read();
     // pop out first response
     $respObj = \Zend\Http\Response::fromString($testResponse);
     $this->adapter->addResponse($respObj);
     $this->assertEquals($testResponse, $this->adapter->read());
 }
Пример #2
0
 /**
  * Zend_Http_Client_Adapter_Test::addResponse()
  *
  * @param string|Zend_Http_Response $response
  * @param string|null $urlPattern
  */
 public function addResponse($response, $urlPattern = null)
 {
     if ($urlPattern === null) {
         parent::addResponse($response);
     }
     if (!isset($this->responsesByPattern[$urlPattern])) {
         $this->responsesByPattern[$urlPattern] = array();
     }
     if ($response instanceof Zend_Http_Response) {
         $response = $response->asString("\r\n");
     }
     $this->responsesByPattern[$urlPattern][] = $response;
 }