public function testResponseCode() { // test default code is 200 $this->assertEquals(200, $this->response->getStatusCode()); // test setting a code $this->response->setStatusCode(404); $this->assertEquals(404, $this->response->getStatusCode()); // test setting an invalid code $this->setExpectedException('BedRest\\Rest\\Exception'); $this->response->setStatusCode(605); }
/** * Dispatches the request to BedRest. */ public function dispatchBedRest(array $options) { if (isset($options['method'])) { $this->_bedRestRequest->setMethod($options['method']); } $restManager = $this->_bedRest->getRestManager(); $this->_bedRestResponse = $restManager->process($this->_bedRestRequest); $response = $this->getResponse(); $response->setHttpResponseCode($this->_bedRestResponse->getStatusCode()); foreach ($this->_bedRestResponse->getHeaders() as $name => $value) { $response->setHeader($name, $value); } $response->setBody($this->_bedRestResponse->getRawBody()); }