Elastica\Response::setTransferInfo PHP Method

setTransferInfo() public method

Sets the transfer info of the curl request. This function is called from the \Elastica\Client::_callService .
public setTransferInfo ( array $transferInfo )
$transferInfo array The curl transfer information.
    public function setTransferInfo(array $transferInfo)
    {
        $this->_transferInfo = $transferInfo;
        return $this;
    }

Usage Example

 /**
  * @group unit
  */
 public function testExists()
 {
     $name = 'index_template1';
     $response = new Response('');
     $response->setTransferInfo(array('http_code' => 200));
     /** @var \PHPUnit_Framework_MockObject_MockObject|Client $clientMock */
     $clientMock = $this->getMock('\\Elastica\\Client', array('request'));
     $clientMock->expects($this->once())->method('request')->with('/_template/' . $name, Request::HEAD, array(), array())->willReturn($response);
     $indexTemplate = new IndexTemplate($clientMock, $name);
     $this->assertTrue($indexTemplate->exists());
 }
All Usage Examples Of Elastica\Response::setTransferInfo