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.
Adding MovieFactoryTest, and fixing the base TestCase to always retur…
…n assoc arrays.
- Loading branch information
1 parent
5f37923
commit 04dc350
Showing
5 changed files
with
66 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?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; | ||
|
||
use Tmdb\Factory\MovieFactory; | ||
|
||
class MovieFactoryTest extends TestCase | ||
{ | ||
const MOVIE_ID = 120; | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldConstructMovie() | ||
{ | ||
/** | ||
* @var MovieFactory $factory | ||
*/ | ||
$factory = $this->getFactory(); | ||
$data = $this->loadByFile('movie/all.json'); | ||
|
||
$movie = $factory->create($data); | ||
|
||
$this->assertInstanceOf('Tmdb\Model\Movie', $movie); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldBeAbleToSetFactories() | ||
{ | ||
$factory = new MovieFactory(); | ||
|
||
$class = new \stdClass(); | ||
|
||
$factory->setCastFactory($class); | ||
$factory->setCrewFactory($class); | ||
$factory->setGenreFactory($class); | ||
$factory->setImageFactory($class); | ||
|
||
$this->assertInstanceOf('stdClass', $factory->getCastFactory()); | ||
$this->assertInstanceOf('stdClass', $factory->getCrewFactory()); | ||
$this->assertInstanceOf('stdClass', $factory->getGenreFactory()); | ||
$this->assertInstanceOf('stdClass', $factory->getImageFactory()); | ||
} | ||
|
||
protected function getFactoryClass() | ||
{ | ||
return 'Tmdb\Factory\MovieFactory'; | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -52,7 +52,8 @@ protected function loadByFile($file) | |
'test/Tmdb/Tests/Resources/', | ||
$file | ||
) | ||
) | ||
), | ||
true | ||
); | ||
} | ||
} |