From c2be7ec2e69df311ba18db6bcf214e0324dec58d Mon Sep 17 00:00:00 2001 From: Michael Roterman Date: Sat, 22 Feb 2014 17:00:13 +0100 Subject: [PATCH] Fix API tests --- test/Tmdb/Tests/Api/CertificationsTest.php | 33 ++++++++++++++++++++++ test/Tmdb/Tests/Api/CreditsTest.php | 33 ++++++++++++++++++++++ test/Tmdb/Tests/Api/NetworksTest.php | 33 ++++++++++++++++++++++ test/Tmdb/Tests/Api/PeopleTest.php | 26 +++++++++++++++++ test/Tmdb/Tests/Api/TvTest.php | 13 +++++++++ 5 files changed, 138 insertions(+) create mode 100644 test/Tmdb/Tests/Api/CertificationsTest.php create mode 100644 test/Tmdb/Tests/Api/CreditsTest.php create mode 100644 test/Tmdb/Tests/Api/NetworksTest.php diff --git a/test/Tmdb/Tests/Api/CertificationsTest.php b/test/Tmdb/Tests/Api/CertificationsTest.php new file mode 100644 index 00000000..041d06a0 --- /dev/null +++ b/test/Tmdb/Tests/Api/CertificationsTest.php @@ -0,0 +1,33 @@ + + * @copyright (c) 2013, Michael Roterman + * @version 0.0.1 + */ +namespace Tmdb\Tests\Api; + +class CertificationsTest extends TestCase +{ + /** + * @test + */ + public function shouldGetCertificationsListForMovies() + { + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('certification/movie/list'); + + $api->getMovieList(); + } + + protected function getApiClass() { + return 'Tmdb\Api\Certifications'; + } +} \ No newline at end of file diff --git a/test/Tmdb/Tests/Api/CreditsTest.php b/test/Tmdb/Tests/Api/CreditsTest.php new file mode 100644 index 00000000..49b63aab --- /dev/null +++ b/test/Tmdb/Tests/Api/CreditsTest.php @@ -0,0 +1,33 @@ + + * @copyright (c) 2013, Michael Roterman + * @version 0.0.1 + */ +namespace Tmdb\Tests\Api; + +class CreditsTest extends TestCase +{ + /** + * @test + */ + public function shouldGetCredit() + { + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('credit/5240760b5dbf5b0c2c0139db'); + + $api->getCredit('5240760b5dbf5b0c2c0139db'); + } + + protected function getApiClass() { + return 'Tmdb\Api\Credits'; + } +} \ No newline at end of file diff --git a/test/Tmdb/Tests/Api/NetworksTest.php b/test/Tmdb/Tests/Api/NetworksTest.php new file mode 100644 index 00000000..14bcbb8b --- /dev/null +++ b/test/Tmdb/Tests/Api/NetworksTest.php @@ -0,0 +1,33 @@ + + * @copyright (c) 2013, Michael Roterman + * @version 0.0.1 + */ +namespace Tmdb\Tests\Api; + +class NetworksTest extends TestCase +{ + /** + * @test + */ + public function shouldGetCredit() + { + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('network/49'); + + $api->getNetwork(49); + } + + protected function getApiClass() { + return 'Tmdb\Api\Networks'; + } +} \ No newline at end of file diff --git a/test/Tmdb/Tests/Api/PeopleTest.php b/test/Tmdb/Tests/Api/PeopleTest.php index 9b3b598b..3421f1d9 100644 --- a/test/Tmdb/Tests/Api/PeopleTest.php +++ b/test/Tmdb/Tests/Api/PeopleTest.php @@ -42,6 +42,32 @@ public function shouldGetCredits() $api->getCredits(self::PERSON_ID); } + /** + * @test + */ + public function shouldGetMovieCredits() + { + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('person/' . self::PERSON_ID . '/movie_credits'); + + $api->getMovieCredits(self::PERSON_ID); + } + + /** + * @test + */ + public function shouldGetTvCredits() + { + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('person/' . self::PERSON_ID . '/tv_credits'); + + $api->getTvCredits(self::PERSON_ID); + } + /** * @test */ diff --git a/test/Tmdb/Tests/Api/TvTest.php b/test/Tmdb/Tests/Api/TvTest.php index 44ca3a83..1d6273d9 100644 --- a/test/Tmdb/Tests/Api/TvTest.php +++ b/test/Tmdb/Tests/Api/TvTest.php @@ -68,6 +68,19 @@ public function shouldGetImages() $api->getImages(self::TV_ID); } + /** + * @test + */ + public function shouldGetTranslations() + { + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('tv/' . self::TV_ID . '/translations'); + + $api->getTranslations(self::TV_ID); + } + /** * @test */