/** * @test */ public function shouldBeFunctional() { $this->assertInstanceOf('Tmdb\\Model\\Image\\BackdropImage', $this->collection->getBackdropImage()); $this->assertEquals('/qCECROwx3TRUEgoZv2Mz2D723QC.jpg', $this->collection->getBackdropPath()); $this->assertEquals(10, $this->collection->getId()); $this->assertEquals('external', $this->collection->getOverview()); $this->assertInstanceOf('Tmdb\\Model\\Collection\\Images', $this->collection->getImages()); $this->assertEquals('Star Wars Collection', $this->collection->getName()); $this->assertInstanceOf('Tmdb\\Model\\Common\\GenericCollection', $this->collection->getParts()); $this->assertInstanceOf('Tmdb\\Model\\Image\\PosterImage', $this->collection->getPosterImage()); $this->assertEquals('/ghd5zOQnDaDW1mxO7R5fXXpZMu.jpg', $this->collection->getPosterPath()); }
/** * {@inheritdoc} * @return \Tmdb\Model\Collection */ public function create(array $data = []) { $collection = new Collection(); if (array_key_exists('parts', $data)) { $collection->setParts($this->getMovieFactory()->createCollection($data['parts'])); } if (array_key_exists('backdrop_path', $data)) { $collection->setBackdropImage($this->getImageFactory()->createFromPath($data['backdrop_path'], 'backdrop_path')); } if (array_key_exists('images', $data)) { $collection->setImages($this->getImageFactory()->createCollectionFromMovie($data['images'])); } if (array_key_exists('poster_path', $data)) { $collection->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path')); } return $this->hydrate($collection, $data); }