From 3f42dc754698fa1bcec3ccab36649838b47bcb8e Mon Sep 17 00:00:00 2001 From: Michael Roterman Date: Fri, 28 Feb 2014 01:54:07 +0100 Subject: [PATCH] Fixing failing test --- test/Tmdb/Tests/HttpClient/HttpClientTest.php | 42 +++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/test/Tmdb/Tests/HttpClient/HttpClientTest.php b/test/Tmdb/Tests/HttpClient/HttpClientTest.php index 21d66d18..a20415b5 100644 --- a/test/Tmdb/Tests/HttpClient/HttpClientTest.php +++ b/test/Tmdb/Tests/HttpClient/HttpClientTest.php @@ -12,7 +12,6 @@ */ namespace Tmdb\Tests\HttpClient; -use \Exception; use Tmdb\Api\AbstractApi; use Tmdb\ApiToken; use Tmdb\Client; @@ -95,6 +94,22 @@ public function shouldCallPost() $this->testApi->post('/', array('name' => 'Henk')); } + /** + * @test + */ + public function shouldCallPostJson() + { + $this->setUp(); + + $this->guzzleMock + ->expects($this->once()) + ->method('postJson') + ->will($this->returnValue($this->getMock('Guzzle\Http\Message\RequestInterface'))) + ; + + $this->testApi->postJson('/', array('name' => 'Henk')); + } + /** * @test */ @@ -131,7 +146,7 @@ public function shouldCallDelete() /** * @test */ - public function put() + public function shouldCallPut() { $this->setUp(); @@ -184,27 +199,38 @@ public function __construct($client) $this->client = $client; } - public function get() { + public function get($path, array $parameters = array(), $headers = array()) + { $this->client->getHttpClient()->get('/'); } - public function head() { + public function head($path, array $parameters = array(), $headers = array()) + { $this->client->getHttpClient()->head('/'); } - public function post() { + public function post($path, $postBody = null, array $parameters = array(), $headers = array()) + { $this->client->getHttpClient()->post('/', array('id' => 1)); } - public function patch() { + public function patch($path, $body = null, array $parameters = array(), $headers = array()) + { $this->client->getHttpClient()->patch('http://www.google.com/'); } - public function delete() { + public function delete($path, $body = null, array $parameters = array(), $headers = array()) + { $this->client->getHttpClient()->delete('http://www.google.com/'); } - public function put() { + public function postJson($path, $postBody = null, array $parameters = array(), $headers = array()) + { + $this->client->getHttpClient()->postJson('http://www.google.com/'); + } + + public function put($path, $body = null, array $parameters = array(), $headers = array()) + { $this->client->getHttpClient()->put('http://www.google.com/'); }