httpAdapter = new Zend_Http_Client_Adapter_Test(); $this->httpClient = new Zend_Http_Client('http://foo', array('adapter' => $this->httpAdapter)); $this->auth = array('username' => 'foo', 'password' => 'bar', 'appKey' => 'baz'); $this->options = array('httpClient' => $this->httpClient); // set first nirvanix response to successful login $this->httpAdapter->setResponse( $this->makeNirvanixResponse(array('ResponseCode' => '0', 'SessionToken' => 'foo')) ); $this->nirvanix = new Zend_Service_Nirvanix($this->auth, $this->options); } public function makeNirvanixResponse($hash) { $xml = ""; foreach ($hash as $k => $v) { $xml .= "<$k>$v"; } $xml .= ""; $resp = $this->makeHttpResponseFrom($xml); return $resp; } public function makeHttpResponseFrom($data, $status=200, $message='OK') { $headers = array("HTTP/1.1 $status $message", "Status: $status", 'Content_Type: text/xml; charset=utf-8', 'Content-Length: ' . strlen($data) ); return implode("\r\n", $headers) . "\r\n\r\n$data\r\n\r\n"; } }