forked from php-tmdb/api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a174ac
commit 5a7be3a
Showing
13 changed files
with
272 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?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 <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Tests\Factory; | ||
|
||
class GenreFactoryTest extends TestCase | ||
{ | ||
const GENRE_ID = 28; | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldConstructGenre() | ||
{ | ||
$object = $this->loadByFile( | ||
'file.json' | ||
); | ||
|
||
$this->assertInstanceOf('Tmdb\Model\Genre', $object); | ||
$this->assertEquals('28', $object->getId()); | ||
$this->assertEquals('Action', $object->getName()); | ||
} | ||
|
||
protected function getFactoryClass() | ||
{ | ||
return 'Tmdb\Factory\GenreFactory'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?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 <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Tests\Factory; | ||
|
||
abstract class TestCase extends \PHPUnit_Framework_TestCase | ||
{ | ||
protected $factory; | ||
|
||
protected function loadByFile($file) | ||
{ | ||
$class = $this->getFactoryClass(); | ||
$factory = new $class(); | ||
|
||
//$data = json_decode(file_get_contents($file)); | ||
$data = array(); | ||
|
||
return $factory->create($data); | ||
} | ||
|
||
abstract protected function getFactoryClass(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?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 <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Tests\Repository; | ||
|
||
use Tmdb\Model\Query\ChangesQuery; | ||
|
||
class ChangesRepositoryTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function shouldGetMovieChanges() | ||
{ | ||
$repository = $this->getRepositoryWithMockedHttpClient(); | ||
|
||
$query = new ChangesQuery(); | ||
|
||
$repository->getMovieChanges($query); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldGetPeopleChanges() | ||
{ | ||
$repository = $this->getRepositoryWithMockedHttpClient(); | ||
|
||
$query = new ChangesQuery(); | ||
|
||
$repository->getPeopleChanges($query); | ||
} | ||
|
||
/** | ||
* There is no generic factory for changes so it should never be called. | ||
* | ||
* @expectedException Tmdb\Exception\NotImplementedException | ||
* @test | ||
*/ | ||
public function getFactoryShouldThrowException() | ||
{ | ||
$repository = $this->getRepositoryWithMockedHttpClient(); | ||
$repository->getFactory(); | ||
} | ||
|
||
protected function getApiClass() | ||
{ | ||
return 'Tmdb\Api\Changes'; | ||
} | ||
|
||
protected function getRepositoryClass() | ||
{ | ||
return 'Tmdb\Repository\ChangesRepository'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.