public function getAllEpisodesForShow($showId) { if (!is_numeric($showId)) { return []; } $episodes = $this->api->getEpisodesOfShow($showId); $episodes = $this->formatEpisodes($episodes); return JsonResponse::create($episodes); }
/** * @vcr bierdopje.yml */ public function test_it_fetches_all_episodes_of_a_show() { $episodes = $this->api->getEpisodesOfShow(16290); $this->assertTrue(count($episodes) >= 93); $episode = $episodes[0]; $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"); }