/** * Creates a new fixture * * @param var status either an int with a status code or an exception object * @param string body default NULL * @param [:string] headers default [:] * @return webservices.rest.RestClient */ public function fixtureWith($status, $body = NULL, $headers = array()) { $fixture = new RestClient(); $fixture->setConnection(self::$conn->newInstance($status, $body, $headers)); return $fixture; }
public function withParameters() { $fixture = new RestClient(); $fixture->setConnection(self::$conn->newInstance()); $this->assertEquals("POST / HTTP/1.1\r\n" . "Connection: close\r\n" . "Host: test\r\n" . "Content-Length: 9\r\n" . "Content-Type: application/x-www-form-urlencoded\r\n" . "\r\n" . "key=value", $fixture->execute(create(new RestRequest('/', HttpConstants::POST))->withParameter('key', 'value'))->content()); }