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.
Unit tests for Review also adjusted the MovieFactory
- Loading branch information
1 parent
849d9e5
commit dc4000f
Showing
5 changed files
with
151 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?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\ReviewFactory; | ||
use Tmdb\Model\Review; | ||
|
||
class ReviewFactoryTest extends TestCase | ||
{ | ||
private $data; | ||
|
||
public function setUp() | ||
{ | ||
$this->data = $this->loadByFile('reviews/get.json'); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldConstructReview() | ||
{ | ||
/** | ||
* @var ReviewFactory $factory | ||
*/ | ||
$factory = $this->getFactory(); | ||
|
||
/** | ||
* @var Review $review | ||
*/ | ||
$review = $factory->create($this->data); | ||
|
||
$review->setContent('content-test'); | ||
|
||
$this->assertInstanceOf('Tmdb\Model\Review', $review); | ||
$this->assertEquals('5013bc76760ee372cb00253e', $review->getId()); | ||
$this->assertEquals('Chris', $review->getAuthor()); | ||
$this->assertEquals('content-test', $review->getContent()); | ||
$this->assertEquals('en', $review->getIso6391()); | ||
$this->assertEquals(49026, $review->getMediaId()); | ||
$this->assertEquals('The Dark Knight Rises', $review->getMediaTitle()); | ||
$this->assertEquals('Movie', $review->getMediaType()); | ||
$this->assertEquals('http://j.mp/P18dg1', $review->getUrl()); | ||
} | ||
|
||
protected function getFactoryClass() | ||
{ | ||
return 'Tmdb\Factory\ReviewFactory'; | ||
} | ||
} |
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,10 @@ | ||
{ | ||
"id": "5013bc76760ee372cb00253e", | ||
"author": "Chris", | ||
"content": "I personally thought this film is on par if not better than the Dark Knight.\r\n\r\nWhilst some think the film is too long for the story I didn't find this. The length of the film is longer than some (but doesn't feel it), I liked that the film took it's time rather than shoving more elements in it - I think this contributed to the dramatic ending (much like a classical piece of music will be relaxed and calm before the final crescendo).\r\n\r\nAt the end of the day whether you like this film will boil down to if you like films Christopher Nolan has directed and/or you like the Christopher Nolan Batman series so far.\r\n\r\nStupendously good film in my opinion.", | ||
"iso_639_1": "en", | ||
"media_id": 49026, | ||
"media_title": "The Dark Knight Rises", | ||
"media_type": "Movie", | ||
"url": "http://j.mp/P18dg1" | ||
} |