addResponses() public method

Set the HTTP response(s) to be returned by this adapter as an array of strings.
public addResponses ( array $responses ) : null
$responses array The responses to be added to the stack.
return null
Beispiel #1
0
 public function testAddArrayResponses()
 {
     $mock = new Horde_Http_Request_Mock();
     $mock->addResponses(array(array('body' => 'A'), array('code' => 404), array('uri' => 'http://example.org'), array('headers' => 'test: TEST')));
     $client = new Horde_Http_Client(array('request' => $mock));
     $this->assertEquals('A', $client->get()->getBody());
     $this->assertEquals(404, $client->get()->code);
     $this->assertEquals('http://example.org', $client->get()->uri);
     $this->assertEquals('TEST', $client->get()->getHeader('test'));
 }
Beispiel #2
0
 private function _getClient($responses)
 {
     $request = new Horde_Http_Request_Mock();
     $request->addResponses($responses);
     return new Horde_Http_Client(array('request' => $request));
 }