Skip to content

Commit

Permalink
Adding tests for the API namespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Jan 26, 2014
1 parent 38450c0 commit a3980c9
Show file tree
Hide file tree
Showing 20 changed files with 1,114 additions and 8 deletions.
90 changes: 90 additions & 0 deletions test/Tmdb/Tests/Api/AccountTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?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\Api;

class AccountTest extends TestCase
{
/**
* @test
* @expectedException Tmdb\Exception\NotImplementedException
*/
public function shouldGetAccount()
{
$api = $this->getApiMock();
$api->getAccount();
}

/**
* @test
* @expectedException Tmdb\Exception\NotImplementedException
*/
public function shouldGetLists()
{
$api = $this->getApiMock();
$api->getLists('account_id');
}

/**
* @test
* @expectedException Tmdb\Exception\NotImplementedException
*/
public function shouldGetFavoriteMovies()
{
$api = $this->getApiMock();
$api->getFavoriteMovies('account_id');
}

/**
* @test
* @expectedException Tmdb\Exception\NotImplementedException
*/
public function shouldFavorite()
{
$api = $this->getApiMock();
$api->favorite('account_id');
}

/**
* @test
* @expectedException Tmdb\Exception\NotImplementedException
*/
public function shouldGetRatedMovies()
{
$api = $this->getApiMock();
$api->getRatedMovies('account_id');
}

/**
* @test
* @expectedException Tmdb\Exception\NotImplementedException
*/
public function shouldGetMovieWatchlist()
{
$api = $this->getApiMock();
$api->getMovieWatchlist('account_id');
}

/**
* @test
* @expectedException Tmdb\Exception\NotImplementedException
*/
public function shouldWatchlist()
{
$api = $this->getApiMock();
$api->watchlist('account_id');
}

protected function getApiClass() {
return 'Tmdb\Api\Account';
}
}
50 changes: 50 additions & 0 deletions test/Tmdb/Tests/Api/AuthenticationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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\Api;

class AuthenticationTest extends TestCase
{
/**
* @test
* @expectedException Tmdb\Exception\NotImplementedException
*/
public function shouldGetNewToken()
{
$api = $this->getApiMock();
$api->getNewToken();
}

/**
* @test
* @expectedException Tmdb\Exception\NotImplementedException
*/
public function shouldGetNewSession()
{
$api = $this->getApiMock();
$api->getNewSession('request_token');
}

/**
* @test
* @expectedException Tmdb\Exception\NotImplementedException
*/
public function shouldGetNewGuestSession()
{
$api = $this->getApiMock();
$api->getNewGuestSession();
}

protected function getApiClass() {
return 'Tmdb\Api\Authentication';
}
}
46 changes: 46 additions & 0 deletions test/Tmdb/Tests/Api/ChangesTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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\Api;

class ChangesTest extends TestCase
{
/**
* @test
*/
public function shouldGetMovieChanges()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('movie/changes');

$api->getMovieChanges();
}

/**
* @test
*/
public function shouldGetPersonChanges()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('person/changes');

$api->getPersonChanges();
}

protected function getApiClass() {
return 'Tmdb\Api\Changes';
}
}
48 changes: 48 additions & 0 deletions test/Tmdb/Tests/Api/CollectionsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?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\Api;

class ColletionsTest extends TestCase
{
const COLLECTION_ID = 120;

/**
* @test
*/
public function shouldGetCollection()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('collection/' . self::COLLECTION_ID);

$api->getCollection(self::COLLECTION_ID);
}

/**
* @test
*/
public function shouldGetImages()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('collection/' . self::COLLECTION_ID . '/images');

$api->getImages(self::COLLECTION_ID);
}

protected function getApiClass() {
return 'Tmdb\Api\Collections';
}
}
48 changes: 48 additions & 0 deletions test/Tmdb/Tests/Api/CompaniesTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?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\Api;

class CompaniesTest extends TestCase
{
const COMPANY_ID = 1;

/**
* @test
*/
public function shouldGetCompany()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('company/' . self::COMPANY_ID);

$api->getCompany(self::COMPANY_ID);
}

/**
* @test
*/
public function shouldGetMovies()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('company/' . self::COMPANY_ID. '/movies');

$api->getMovies(self::COMPANY_ID);
}

protected function getApiClass() {
return 'Tmdb\Api\Companies';
}
}
33 changes: 33 additions & 0 deletions test/Tmdb/Tests/Api/ConfigurationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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\Api;

class ConfigurationTest extends TestCase
{
/**
* @test
*/
public function shouldGetConfiguration()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('configuration');

$api->getConfiguration();
}

protected function getApiClass() {
return 'Tmdb\Api\Configuration';
}
}
46 changes: 46 additions & 0 deletions test/Tmdb/Tests/Api/DiscoverTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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\Api;

class DiscoverTest extends TestCase
{
/**
* @test
*/
public function shouldDiscoverMovies()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('discover/movie');

$api->discoverMovies();
}

/**
* @test
*/
public function shouldDiscoverTv()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('discover/tv');

$api->discoverTv();
}

protected function getApiClass() {
return 'Tmdb\Api\Discover';
}
}
Loading

0 comments on commit a3980c9

Please sign in to comment.