public function getEpisodesForSeason($showId, $season) { if (!is_numeric($showId) || !is_numeric($season)) { return []; } $episodes = $this->api->getEpisodesOfSeason($showId, $season); $episodes = $this->formatEpisodes($episodes); return JsonResponse::create($episodes); }
/** * @vcr bierdopje.yml */ public function test_it_fetches_all_episodes_of_a_season_for_show() { $episodes = $this->api->getEpisodesOfSeason(16290, 2); $this->assertEquals(count($episodes), 24); $episode = $episodes[0]; $this->assertEquals($episode->id, 772542); $this->assertEquals($episode->tvdbId, 4599381); $this->assertEquals($episode->title, "City of Heroes"); $this->assertEquals($episode->season, 2); $this->assertEquals($episode->episode, 1); $this->assertEquals($episode->airDate->format('d-m-Y'), '09-10-2013'); $this->assertFalse($episode->is_special, 'Is not a special episode'); $this->assertEquals($episode->formatted, 'S02E01'); $this->assertTrue(strlen($episode->summary) > 100, "summary has more than 100 characters"); }