/** * Adds a new CakeResponse object to the response collection. * * @param integer $tid Transaction ID * @param CakeResponse $response Cake response object * @param CakeRequest $request CakeRequest object * @param boolean $exception TRUE if the response is an exception. * @return BanchaResponseCollection */ public function addResponse($tid, CakeResponse $response, CakeRequest $request, $exception = false) { $response = array('type' => 'rpc', 'tid' => $tid, 'action' => Inflector::singularize($request->controller), 'method' => BanchaResponseTransformer::getMethod($request), 'result' => BanchaResponseTransformer::transform($response->body(), $request)); if ($request['extUpload']) { $response['extUpload'] = true; } $this->responses[] = $response; return $this; }
/** * Unrecognizable structures are just passed through * @param $cakeResponse cake response to transform * * @dataProvider getUnrecognizableResponses */ public function testTransformUnrecognizable($cakeResponse) { $request = new CakeRequest(); $request->addParams(array('controller' => 'Articles', 'action' => 'delete')); $this->assertEquals($cakeResponse, BanchaResponseTransformer::transform($cakeResponse, $request)); }