diff --git a/lib/Tmdb/Api/Authentication.php b/lib/Tmdb/Api/Authentication.php index a28862c9..58ad244f 100644 --- a/lib/Tmdb/Api/Authentication.php +++ b/lib/Tmdb/Api/Authentication.php @@ -44,11 +44,13 @@ public function getNewToken() */ public function authenticateRequestToken($token) { + //@codeCoverageIgnoreStart header(sprintf( 'Location: %s/%s', self::REQUEST_TOKEN_URI, $token )); + //@codeCoverageIgnoreEnd } /** @@ -63,10 +65,12 @@ public function getNewSession($requestToken) { try { return $this->get('authentication/session/new', array('request_token' => $requestToken)); + //@codeCoverageIgnoreStart } catch (\Exception $e) { if ($e->getCode() == 401) { throw new UnauthorizedRequestTokenException("The request token has not been validated yet."); } + //@codeCoverageIgnoreEnd } } diff --git a/lib/Tmdb/Model/Network.php b/lib/Tmdb/Model/Network.php index f7174d3e..d71d64a9 100644 --- a/lib/Tmdb/Model/Network.php +++ b/lib/Tmdb/Model/Network.php @@ -18,9 +18,23 @@ */ class Network extends AbstractModel { + /** + * @var integer + */ private $id; + + /** + * @var string + */ private $name; + /** + * Properties that are available in the API + * + * These properties are hydrated by the ObjectHydrator, all the other properties are handled by the factory. + * + * @var array + */ public static $properties = array( 'id', 'name', diff --git a/test/Tmdb/Tests/Api/PeopleTest.php b/test/Tmdb/Tests/Api/PeopleTest.php index 257c5e9d..ad16fe42 100644 --- a/test/Tmdb/Tests/Api/PeopleTest.php +++ b/test/Tmdb/Tests/Api/PeopleTest.php @@ -94,6 +94,19 @@ public function shouldGetChanges() $api->getChanges(self::PERSON_ID); } + /** + * @test + */ + public function shouldGetExternalIds() + { + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('person/' . self::PERSON_ID . '/external_ids'); + + $api->getExternalIds(self::PERSON_ID); + } + /** * @test */ diff --git a/test/Tmdb/Tests/Model/NetworkTest.php b/test/Tmdb/Tests/Model/NetworkTest.php new file mode 100644 index 00000000..ac894cc1 --- /dev/null +++ b/test/Tmdb/Tests/Model/NetworkTest.php @@ -0,0 +1,37 @@ + + * @copyright (c) 2013, Michael Roterman + * @version 0.0.1 + */ +namespace Tmdb\Tests\Model; + +use Tmdb\Common\ObjectHydrator; +use Tmdb\Model\Network; + +class NetworkTest extends TestCase +{ + /** + * @test + */ + public function shouldBeFunctional() + { + $data = array( + 'id' => 1, + 'name' => 'name', + ); + + $hydrator = new ObjectHydrator(); + + $object = $hydrator->hydrate(new Network(), $data); + + $this->assertEquals(1, $object->getId()); + $this->assertEquals('name', $object->getName()); + } +}