Skip to content

Commit

Permalink
AbstractMember coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Feb 8, 2014
1 parent adfc8dd commit eb2a91a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Tmdb/Model/Person/AbstractMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,14 @@ public function getProfile()
{
return $this->profile;
}

/**
* Assert if there is an profile image object
*
* @return bool
*/
public function hasProfileImage()
{
return $this->profile instanceof Image;
}
}
21 changes: 21 additions & 0 deletions test/Tmdb/Tests/Factory/MovieFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use Tmdb\Factory\MovieFactory;
use Tmdb\Model\Movie;
use Tmdb\Model\Person\CastMember;

class MovieFactoryTest extends TestCase
{
Expand Down Expand Up @@ -122,6 +123,26 @@ public function shouldBeAbleToDissectResults()
$this->assertEquals(2, count($collection));
}

/**
* @test
*/
public function shouldGetProfileImages()
{
$cast = $this->movie->getCredits()->getCast();

/**
* @var CastMember $c
*/
foreach($cast as $c) {
if ($c->hasProfileImage()) {
$filePath = $c->getProfile()->getFilePath();
$this->assertEquals(false, empty($filePath));
}else{
$this->assertEquals(null, $c->getProfile());
}
}
}

protected function getFactoryClass()
{
return 'Tmdb\Factory\MovieFactory';
Expand Down

0 comments on commit eb2a91a

Please sign in to comment.