Exemple #1
0
 /**
  * @test
  */
 public function shouldBeAbleToOverrideDefaultCollections()
 {
     $season = new Season();
     $class = new \stdClass();
     $season->setCredits($class);
     $this->assertInstanceOf('stdClass', $season->getCredits());
 }
Exemple #2
0
 /**
  * @test
  */
 public function shouldGetVideos()
 {
     $repository = $this->getRepositoryWithMockedHttpClient();
     $tv = new Tv();
     $tv->setId(self::TV_ID);
     $season = new Tv\Season();
     $season->setId(self::SEASON_ID);
     $repository->getVideos($tv, $season);
 }
Exemple #3
0
 /**
  * @test
  */
 public function shouldBeFunctional()
 {
     $this->assertEquals(new \DateTime('2009-03-08'), $this->season->getAirDate());
     $this->assertEquals('Season 2', $this->season->getName());
     $this->assertEquals('The second season of the American television drama series Breaking Bad premiered on March 8, 2009 and concluded on May 31, 2009. It consisted of 13 episodes, each running approximately 47 minutes in length. AMC broadcast the second season on Sundays at 10:00 pm in the United States. The complete second season was released on Region 1 DVD and Region A Blu-ray on March 16, 2010.', $this->season->getOverview());
     $this->assertEquals(3573, $this->season->getId());
     $this->assertEquals('/rCdISteF1GPvPsy0a5L0LDffjtP.jpg', $this->season->getPosterPath());
     $this->assertEquals(2, $this->season->getSeasonNumber());
 }
 /**
  * {@inheritdoc}
  */
 public function create(array $data = [])
 {
     if (!$data) {
         return null;
     }
     $tvSeason = new Season();
     if (array_key_exists('credits', $data)) {
         if (array_key_exists('cast', $data['credits']) && $data['credits']['cast'] !== null) {
             $tvSeason->getCredits()->setCast($this->getCastFactory()->createCollection($data['credits']['cast'], new CastMember()));
         }
         if (array_key_exists('crew', $data['credits']) && $data['credits']['crew'] !== null) {
             $tvSeason->getCredits()->setCrew($this->getCrewFactory()->createCollection($data['credits']['crew'], new CrewMember()));
         }
     }
     /** External ids */
     if (array_key_exists('external_ids', $data) && $data['external_ids'] !== null) {
         $tvSeason->setExternalIds($this->hydrate(new ExternalIds(), $data['external_ids']));
     }
     /** Images */
     if (array_key_exists('images', $data) && $data['images'] !== null) {
         $tvSeason->setImages($this->getImageFactory()->createCollectionFromTvSeason($data['images']));
     }
     if (array_key_exists('poster_path', $data)) {
         $tvSeason->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path'));
     }
     /** Episodes */
     if (array_key_exists('episodes', $data) && $data['episodes'] !== null) {
         $tvSeason->setEpisodes($this->getTvEpisodeFactory()->createCollection($data['episodes']));
     }
     if (array_key_exists('videos', $data) && $data['videos'] !== null) {
         $tvSeason->setVideos($this->getVideoFactory()->createCollection($data['videos']));
     }
     if (array_key_exists('changes', $data) && $data['changes'] !== null) {
         $tvSeason->setChanges($this->getChangesFactory()->createCollection($data['changes']));
     }
     return $this->hydrate($tvSeason, $data);
 }
 /**
  * @expectedException Tmdb\Exception\RuntimeException
  * @test
  */
 public function shouldThrowExceptionWhenConditionsNotMet()
 {
     $repository = $this->getRepositoryWithMockedHttpClient();
     $tv = new Tv();
     $tv->setId(self::TV_ID);
     $season = new Season();
     $season->setId(self::SEASON_ID);
     $repository->load($tv, $season, null);
 }
 /**
  * @test
  */
 public function shouldGetVideos()
 {
     $repository = $this->getRepositoryWithMockedHttpAdapter();
     $this->getAdapter()->expects($this->once())->method('get')->with($this->getRequest('tv/' . self::TV_ID . '/season/' . self::SEASON_ID . '/videos'));
     $tv = new Tv();
     $tv->setId(self::TV_ID);
     $season = new Tv\Season();
     $season->setId(self::SEASON_ID);
     $repository->getVideos($tv, $season);
 }