Skip to content

Commit

Permalink
Adding CreditsRepositoryTest and removing unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Feb 23, 2014
1 parent d043fae commit 7870f85
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 30 deletions.
30 changes: 0 additions & 30 deletions lib/Tmdb/Repository/CreditsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

use Tmdb\Factory\CompanyFactory;
use Tmdb\Factory\CreditsFactory;
use Tmdb\Factory\TvFactory;
use Tmdb\Model\Common\GenericCollection;
use Tmdb\Model\Company;
use Tmdb\Model\Movie;

Expand Down Expand Up @@ -52,32 +50,4 @@ public function getFactory()
{
return new CreditsFactory();
}

/**
* @return TvFactory
*/
public function getTvFactory()
{
return new TvFactory();
}

/**
* Create an collection of an array
*
* @param $data
* @return Movie[]
*/
public function createMovieCollection($data){
$collection = new GenericCollection();

if (array_key_exists('results', $data)) {
$data = $data['results'];
}

foreach($data as $item) {
$collection->add(null, $this->getMovieFactory()->create($item));
}

return $collection;
}
}
40 changes: 40 additions & 0 deletions test/Tmdb/Tests/Repository/CreditsRepositoryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <michael@wtfz.net>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
namespace Tmdb\Tests\Repository;

use Tmdb\Repository\CreditsRepository;

class CreditsRepositoryTest extends TestCase
{
const CREDITS_ID = '5240760b5dbf5b0c2c0139db';

/**
* @test
*/
public function shouldLoadCredits()
{
$repository = $this->getRepositoryWithMockedHttpClient();

$repository->load(self::CREDITS_ID);
}

protected function getApiClass()
{
return 'Tmdb\Api\Credits';
}

protected function getRepositoryClass()
{
return 'Tmdb\Repository\CreditsRepository';
}
}

0 comments on commit 7870f85

Please sign in to comment.