/** * @param array $data * * @return Genre */ public function create(array $data = []) { $lists = new Lists(); if (array_key_exists('items', $data)) { $lists->setItems($this->getListItemFactory()->createCollection($data['items'])); } /** Images */ if (array_key_exists('poster_path', $data)) { $lists->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path')); } return $this->hydrate($lists, $data); }
/** * @test */ public function shouldBeFunctional() { $this->assertEquals('Travis Bell', $this->lists->getCreatedBy()); $this->assertEquals('Here\'s my list of best picture winners for the Oscars. Thought it would be neat to see them all together. There\'s a lot of movies here I have never even heard of.', $this->lists->getDescription()); $this->assertEquals(18, $this->lists->getFavoriteCount()); $this->assertEquals('509ec17b19c2950a0600050d', $this->lists->getId()); $this->assertInstanceOf('Tmdb\\Model\\Common\\GenericCollection', $this->lists->getItems()); $this->assertEquals(85, $this->lists->getItemCount()); $this->assertEquals('en', $this->lists->getIso6391()); $this->assertEquals('Best Picture Winners - The Academy Awards', $this->lists->getName()); $this->assertEquals('/efBm2Nm2v5kQnO0w3hYcW6hVsJU.jpg', $this->lists->getPosterPath()); $this->assertInstanceOf('Tmdb\\Model\\Image\\PosterImage', $this->lists->getPosterImage()); }