/** * @param Request $request * * @return JsonResponse */ public function handleShowSpeakerProfile(Request $request) { try { $profile = $this->speakers->findProfile(); return $this->respond($profile->toArrayForApi()); } catch (NotAuthenticatedException $e) { return $this->respondUnauthorized(); } catch (Exception $e) { return $this->respondInternalError($e->getMessage()); } }
/** @test */ public function it_throws_an_exception_when_speaker_is_not_found() { $this->trainStudentRepositoryToThrowEntityNotFoundException(); $this->setExpectedException('OpenCFP\\Domain\\EntityNotFoundException'); $this->sut->findProfile(); }