public function testSetRequestedScope() { $response = new Response($fractal = m::mock('League\\Fractal\\Manager'), m::mock('Paxifi\\Support\\Response\\Item'), m::mock('Paxifi\\Support\\Response\\Collection'), m::mock('Paxifi\\Support\\Response\\Paginator'), m::mock('Paxifi\\Support\\Response\\Cursor')); $fractal->shouldReceive('setRequestedScopes')->with(array('foo', 'bar'))->once(); $response->setRequestedScopes(array('foo', 'bar')); }
/** * Responds with collection. * * @param mixed $data * @param bool $paginated * * @return \Illuminate\Http\JsonResponse */ public function respondWithCollection($data, $paginated = false) { $this->response->setTransformer($this->getTransformer())->setContent($data); return $this->respond($this->response->withCollection($paginated)); }