diff --git a/lib/Tmdb/Factory/ImageFactory.php b/lib/Tmdb/Factory/ImageFactory.php index 74956976..38ccf8e4 100644 --- a/lib/Tmdb/Factory/ImageFactory.php +++ b/lib/Tmdb/Factory/ImageFactory.php @@ -54,29 +54,6 @@ public function createFromPath($path, $key) ); } - /** - * Return possible image type keys - * - * @return string[] - */ - public function getPossibleKeys() - { - return array( - 'poster', - 'posters', - 'poster_path', - 'backdrop', - 'backdrops', - 'backdrop_path', - 'profile', - 'profiles', - 'profile_path', - 'logo', - 'logos', - 'logo_path', - ); - } - /** * @param string|null $key * @return Image|Image\BackdropImage|Image\LogoImage|Image\PosterImage|Image\ProfileImage|Image\StillImage diff --git a/lib/Tmdb/Repository/CompanyRepository.php b/lib/Tmdb/Repository/CompanyRepository.php index 84db9ea4..0b88d904 100644 --- a/lib/Tmdb/Repository/CompanyRepository.php +++ b/lib/Tmdb/Repository/CompanyRepository.php @@ -80,7 +80,7 @@ public function getMovieFactory() * @param $data * @return Movie[] */ - private function createMovieCollection($data){ + public function createMovieCollection($data){ $collection = new GenericCollection(); if (array_key_exists('results', $data)) { diff --git a/lib/Tmdb/Repository/GenreRepository.php b/lib/Tmdb/Repository/GenreRepository.php index 133b23ea..8fdc402f 100644 --- a/lib/Tmdb/Repository/GenreRepository.php +++ b/lib/Tmdb/Repository/GenreRepository.php @@ -71,4 +71,12 @@ public function getApi() { return $this->getClient()->getGenresApi(); } -} + + /** + * @return GenreFactory + */ + public function getFactory() + { + return new GenreFactory(); + } +} \ No newline at end of file diff --git a/test/Tmdb/Tests/Api/TestCase.php b/test/Tmdb/Tests/Api/TestCase.php index acde92d0..a28bb306 100644 --- a/test/Tmdb/Tests/Api/TestCase.php +++ b/test/Tmdb/Tests/Api/TestCase.php @@ -33,7 +33,7 @@ protected function getApiMock(array $methods = array()) return $this->getMockBuilder($this->getApiClass()) ->setMethods( array_merge( - array('get', 'post', 'postRaw', 'patch', 'delete', 'put'), + array('get', 'post', 'postRaw', 'head', 'patch', 'delete', 'put'), $methods ) ) diff --git a/test/Tmdb/Tests/Repository/CompanyRepositoryTest.php b/test/Tmdb/Tests/Repository/CompanyRepositoryTest.php index d3ade661..6838e608 100644 --- a/test/Tmdb/Tests/Repository/CompanyRepositoryTest.php +++ b/test/Tmdb/Tests/Repository/CompanyRepositoryTest.php @@ -37,6 +37,25 @@ public function shouldGetMovies() } + /** + * @test + */ + public function callingGetMoviesWithFakeRequestWillReturnMovieCollection() + { + $repository = $this->getRepositoryWithMockedHttpClient(); + + $collection = $repository->createMovieCollection( + array('results' => array( + array('id' => 1), + array('id' => 2) + ) + )); + + foreach($collection as $movie) { + $this->assertInstanceOf('Tmdb\Model\Movie', $movie); + } + } + protected function getApiClass() { return 'Tmdb\Api\Company';