public function testTransformationException() { $this->setExpectedException(ApiTransformationException::class); $transformer = new CartTransformer(); $rawItem = '{"customer_id": "1", "item_id1": "2"}'; $transformer->transform($rawItem); }
public function postAddAction(Request $request) { $response = new ApiResponse(); $cartModel = $this->get('restapibundle.model.carts'); $cartTransformer = new CartTransformer(); $cart = $cartTransformer->transform($request->getContent()); $cartModel->add($cart, $response); return $response->getResponse(); }