public function getEpisodeById($episodeId) { if (!is_numeric($episodeId)) { return []; } $episode = $this->api->getEpisodeById($episodeId); $episode = $this->formatEpisode($episode); return JsonResponse::create($episode); }
/** * @vcr bierdopje.yml */ public function test_it_fetches_an_episode_by_id() { $episode = $this->api->getEpisodeById(814124); $this->assertEquals($episode->id, 814124); $this->assertEquals($episode->tvdbId, 4659835); $this->assertEquals($episode->title, "Year One"); $this->assertEquals($episode->season, 0); $this->assertEquals($episode->episode, 1); $this->assertEquals($episode->airDate->format('d-m-Y'), '02-10-2013'); $this->assertTrue($episode->is_special, 'Is not a special episode'); $this->assertEquals($episode->formatted, 'S00E01'); $this->assertTrue(strlen($episode->summary) > 100, "summary has more than 100 characters"); }