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.
- Loading branch information
1 parent
83b48f7
commit dc8f050
Showing
8 changed files
with
168 additions
and
89 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
50 changes: 50 additions & 0 deletions
50
test/Tmdb/Tests/Factory/Movie/AlternativeTitleFactoryTest.php
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,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\Factory\Movie; | ||
|
||
use Tmdb\Factory\Movie\AlternativeTitleFactory; | ||
use Tmdb\Model\Movie\AlternativeTitle; | ||
use Tmdb\Tests\Factory\TestCase; | ||
|
||
class AlternativeTitleFactoryTest extends TestCase | ||
{ | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldConstructAlternativeTitle() | ||
{ | ||
/** | ||
* @var AlternativeTitleFactory $factory | ||
*/ | ||
$factory = $this->getFactory(); | ||
$data = array( | ||
'iso_3166_1' => 'nl', | ||
'title' => 'Kaas' | ||
); | ||
|
||
/** | ||
* @var AlternativeTitle | ||
*/ | ||
$title = $factory->create($data); | ||
|
||
$this->assertInstanceOf('Tmdb\Model\Movie\AlternativeTitle', $title); | ||
$this->assertEquals('nl', $title->getIso31661()); | ||
$this->assertEquals('Kaas', $title->getTitle()); | ||
} | ||
|
||
protected function getFactoryClass() | ||
{ | ||
return 'Tmdb\Factory\Movie\AlternativeTitleFactory'; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
test/Tmdb/Tests/HttpClient/Plugin/AcceptJsonHeaderPluginTest.php
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,43 @@ | ||
<?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\HttpClient\Plugin; | ||
|
||
use Guzzle\Common\Event; | ||
use Guzzle\Http\Message\Request; | ||
use Tmdb\HttpClient\Plugin\AcceptJsonHeaderPlugin; | ||
use Tmdb\Tests\TestCase; | ||
|
||
class AcceptJsonHeaderPluginTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function shouldAddToken() | ||
{ | ||
/** | ||
* @var Request $request | ||
*/ | ||
$request = new Request('GET', '/'); | ||
|
||
$event = new Event(); | ||
$event['request'] = $request; | ||
|
||
$plugin = new AcceptJsonHeaderPlugin(); | ||
|
||
$plugin->onBeforeSend($event); | ||
|
||
$header = $event['request']->getHeaders()->get('accept'); | ||
|
||
$this->assertEquals('application/json', (string) $header); | ||
} | ||
} |
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,40 @@ | ||
<?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\HttpClient\Plugin; | ||
|
||
use Guzzle\Common\Event; | ||
use Guzzle\Http\Message\Request; | ||
use Tmdb\ApiToken; | ||
use Tmdb\HttpClient\Plugin\ApiTokenPlugin; | ||
use Tmdb\Tests\TestCase; | ||
|
||
class ApiTokenPluginTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function shouldAddToken() | ||
{ | ||
$token = new ApiToken('abcdef'); | ||
$request = new Request('GET', '/'); | ||
|
||
$event = new Event(); | ||
$event['request'] = $request; | ||
|
||
$plugin = new ApiTokenPlugin($token); | ||
|
||
$plugin->onBeforeSend($event); | ||
|
||
$this->assertEquals('/?api_key=abcdef', $event['request']->getUrl()); | ||
} | ||
} |
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