Skip to content

Commit

Permalink
Reviewing
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Jan 30, 2014
1 parent 4d73a02 commit c6e4bfb
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 26 deletions.
23 changes: 0 additions & 23 deletions lib/Tmdb/Factory/ImageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/Tmdb/Repository/CompanyRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
10 changes: 9 additions & 1 deletion lib/Tmdb/Repository/GenreRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,12 @@ public function getApi()
{
return $this->getClient()->getGenresApi();
}
}

/**
* @return GenreFactory
*/
public function getFactory()
{
return new GenreFactory();
}
}
2 changes: 1 addition & 1 deletion test/Tmdb/Tests/Api/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
Expand Down
19 changes: 19 additions & 0 deletions test/Tmdb/Tests/Repository/CompanyRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit c6e4bfb

Please sign in to comment.