public function handleViewTalk(Request $request, $id) { try { $talk = $this->speakers->getTalk($id); return $this->setStatusCode(Response::HTTP_OK)->respond($talk->toArrayForApi()); } catch (NotAuthenticatedException $e) { return $this->respondUnauthorized(); } }
/** @test */ public function it_guards_if_spot_relation_ever_returns_talks_that_arent_owned_by_speaker() { $this->trainIdentityProviderToReturnSampleSpeaker($this->getSpeakerFromMisbehavingSpot()); $this->setExpectedException('OpenCFP\\Application\\NotAuthorizedException'); $this->sut->getTalk(1); }
/** @test */ public function it_guards_if_spot_relation_ever_returns_talks_that_arent_owned_by_speaker() { $this->trainStudentRepositoryToReturnSampleSpeaker($this->getSpeakerFromMisbehavingSpot()); $this->setExpectedException('OpenCFP\\Application\\NotAuthorizedException'); $this->sut->getTalk(self::SPEAKER_ID, 1); }