/** @test */ public function it_retrieves_all_talks_for_authenticated_speaker() { $this->identityProvider->shouldReceive('getCurrentUser')->once()->andReturn($this->getSpeakerWithManyTalks()); $talks = $this->sut->getTalks(); $this->assertEquals('Testy Talk', $talks[0]->title); $this->assertEquals('Another Talk', $talks[1]->title); $this->assertEquals('Yet Another Talk', $talks[2]->title); }
public function handleViewAllTalks(Request $request) { try { $talks = $this->speakers->getTalks(); // TODO Replace this crap with an object responsible for // the "Talk Resource" to/from json. $output = []; foreach ($talks as $talk) { $output[] = $talk->toArrayForApi(); } return $this->setStatusCode(Response::HTTP_OK)->respond($output); } catch (NotAuthenticatedException $e) { return $this->respondUnauthorized(); } }