Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Guzzle 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
matteocacciola committed Dec 9, 2020
1 parent ba54a43 commit 1ad104a
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 32 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ composer.lock
composer.phar
build/*
vendor/*
*.idea/
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"require": {
"php": ">=5.3",
"guzzlehttp/guzzle": "~7"
"guzzlehttp/guzzle": "~5.3"
},
"require-dev": {
"phpunit/phpunit": "^4.8"
Expand Down
6 changes: 3 additions & 3 deletions lib/Trello/Api/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function getField($id, $field)
* @param array $parameters GET parameters.
* @param array $requestHeaders Request Headers.
*
* @return \Guzzle\Http\EntityBodyInterface|mixed|string
* @return mixed
*/
protected function get($path, array $parameters = array(), $requestHeaders = array())
{
Expand All @@ -126,7 +126,7 @@ protected function get($path, array $parameters = array(), $requestHeaders = arr
* @param array $parameters HEAD parameters.
* @param array $requestHeaders Request headers.
*
* @return \Guzzle\Http\Message\Response
* @return \GuzzleHttp\Message\Response
*/
protected function head($path, array $parameters = array(), $requestHeaders = array())
{
Expand Down Expand Up @@ -162,7 +162,7 @@ protected function post($path, array $parameters = array(), $requestHeaders = ar
* @param mixed $body Request body.
* @param array $requestHeaders Request headers.
*
* @return \Guzzle\Http\EntityBodyInterface|mixed|string
* @return mixed
*/
protected function postRaw($path, $body, $requestHeaders = array())
{
Expand Down
8 changes: 4 additions & 4 deletions lib/Trello/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Trello\HttpClient;

use Guzzle\Http\Client as GuzzleClient;
use Guzzle\Http\ClientInterface;
use Guzzle\Http\Message\Request;
use Guzzle\Http\Message\Response;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Message\Request;
use GuzzleHttp\Message\Response;
use Trello\Exception\ErrorException;
use Trello\Exception\RuntimeException;
use Trello\HttpClient\Listener\AuthListener;
Expand Down
2 changes: 1 addition & 1 deletion lib/Trello/HttpClient/HttpClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Trello\HttpClient;

use Trello\Exception\InvalidArgumentException;
use Guzzle\Http\Message\Response;
use GuzzleHttp\Message\Response;

interface HttpClientInterface
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Trello/HttpClient/Listener/AuthListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Trello\HttpClient\Listener;

use Guzzle\Common\Event;
use GuzzleHttp\Event\AbstractRequestEvent as Event;
use Trello\Client;
use Trello\Exception\RuntimeException;

Expand Down
3 changes: 1 addition & 2 deletions lib/Trello/HttpClient/Listener/ErrorListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Trello\HttpClient\Listener;

use Trello\HttpClient\Message\ResponseMediator;
use Guzzle\Common\Event;
use GuzzleHttp\Event\AbstractRequestEvent as Event;
use Trello\Exception\ErrorException;
use Trello\Exception\RuntimeException;
use Trello\Exception\PermissionDeniedException;
Expand All @@ -20,7 +20,6 @@ class ErrorListener
*/
public function onRequestError(Event $event)
{
/** @var $request \Guzzle\Http\Message\Request */
$request = $event['request'];
$response = $request->getResponse();

Expand Down
4 changes: 2 additions & 2 deletions lib/Trello/HttpClient/Message/ResponseMediator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Trello\HttpClient\Message;

use Guzzle\Http\Message\Response;
use GuzzleHttp\Message\Response;

class ResponseMediator
{
public static function getContent(Response $response)
{
$body = $response->getBody(true);
$body = $response->getBody();

$content = json_decode($body, true);

Expand Down
2 changes: 1 addition & 1 deletion test/Trello/Tests/Unit/Api/AbstractApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected function getHttpMock()

protected function getHttpClientMock()
{
$mock = $this->getMockBuilder('Guzzle\Http\Client')
$mock = $this->getMockBuilder('GuzzleHttp\Client')
->setMethods(array('send'))
->getMock();
$mock->expects($this->any())
Expand Down
2 changes: 1 addition & 1 deletion test/Trello/Tests/Unit/Api/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function getPath()

protected function getApiMock()
{
$httpClient = $this->getMockBuilder('Guzzle\Http\Client')
$httpClient = $this->getMockBuilder('GuzzleHttp\Client')
->setMethods(array('send'))
->getMock();
$httpClient->expects($this->any())
Expand Down
12 changes: 6 additions & 6 deletions test/Trello/Tests/Unit/HttpClient/HttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Trello\Client;
use Trello\HttpClient\HttpClient;
use Guzzle\Http\Message\Response;
use Guzzle\Http\Client as GuzzleClient;
use GuzzleHttp\Message\Response;
use GuzzleHttp\Client as GuzzleClient;

class HttpClientTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -180,7 +180,7 @@ public function shouldAllowToReturnRawContent()
$parameters = array('a = b');
$headers = array('c' => 'd');

$message = $this->getMockBuilder('Guzzle\Http\Message\Response')
$message = $this->getMockBuilder('GuzzleHttp\Message\Response')
->setConstructorArgs(array(200))
->setMethods(array('getBody'))
->getMock();
Expand All @@ -197,17 +197,17 @@ public function shouldAllowToReturnRawContent()
$response = $httpClient->get($path, $parameters, $headers);

$this->assertEquals("Just raw context", $response->getBody());
$this->assertInstanceOf('Guzzle\Http\Message\MessageInterface', $response);
$this->assertInstanceOf('GuzzleHttp\Message\MessageInterface', $response);
}

protected function getBrowserMock(array $methods = array())
{
$mockMethods = array('send', 'createRequest') + $methods;
$mock = $this->getMockBuilder( 'Guzzle\Http\Client')
$mock = $this->getMockBuilder( 'GuzzleHttp\Client')
->setMethods($mockMethods)
->getMock();

$requestMock = $this->getMockBuilder('Guzzle\Http\Message\Request')
$requestMock = $this->getMockBuilder('GuzzleHttp\Message\Request')
->setConstructorArgs(array('GET', 'some'))
->getMock();

Expand Down
12 changes: 6 additions & 6 deletions test/Trello/Tests/Unit/HttpClient/Listener/AuthListenerTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Trello\Tests\HttpClient;

use Guzzle\Http\Message\Request;
use GuzzleHttp\Message\Request;
use Trello\Client;
use Trello\HttpClient\Listener\AuthListener;

Expand All @@ -25,7 +25,7 @@ public function shouldHaveKnownMethodName()
*/
public function shouldDoNothingForHaveNullMethod()
{
$request = $this->getMockBuilder('Guzzle\Http\Message\RequestInterface')
$request = $this->getMockBuilder('GuzzleHttp\Message\RequestInterface')
->getMock();
$request->expects($this->never())
->method('addHeader');
Expand All @@ -40,7 +40,7 @@ public function shouldDoNothingForHaveNullMethod()
*/
public function shouldDoNothingForPostSend()
{
$request = $this->getMockBuilder('Guzzle\Http\Message\RequestInterface')
$request = $this->getMockBuilder('GuzzleHttp\Message\RequestInterface')
->getMock();
$request->expects($this->never())
->method('addHeader');
Expand All @@ -56,7 +56,7 @@ public function shouldDoNothingForPostSend()
public function shouldSetAuthBasicHeaderForAuthPassMethod()
{
$expected = 'Basic '.base64_encode('login2:pass42323');
$request = $this->getMockBuilder('Guzzle\Http\Message\RequestInterface')
$request = $this->getMockBuilder('GuzzleHttp\Message\RequestInterface')
->getMock();
$request->expects($this->once())
->method('setHeader')
Expand All @@ -76,7 +76,7 @@ public function shouldSetAuthBasicHeaderForAuthPassMethod()
public function shouldSetAuthTokenHeaderForAuthPassMethod()
{
$expected = 'token test';
$request = $this->getMockBuilder('Guzzle\Http\Message\RequestInterface')
$request = $this->getMockBuilder('GuzzleHttp\Message\RequestInterface')
->getMock();
$request->expects($this->once())
->method('setHeader')
Expand Down Expand Up @@ -114,7 +114,7 @@ public function shouldSetClientDetailsInUrlForAuthUrlMethod()

private function getEventMock($request = null)
{
$mock = $this->getMockBuilder('Guzzle\Common\Event')->getMock();
$mock = $this->getMockBuilder('GuzzleCommon\Event')->getMock();
if ($request) {
$mock->expects($this->any())
->method('offsetGet')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ErrorListenerTest extends \PHPUnit_Framework_TestCase
*/
public function shouldPassIfResponseNotHaveErrorStatus()
{
$response = $this->getMockBuilder('Guzzle\Http\Message\Response')
$response = $this->getMockBuilder('GuzzleHttp\Message\Response')
->disableOriginalConstructor()
->getMock();
$response->expects($this->once())
Expand Down Expand Up @@ -126,9 +126,9 @@ public function getErrorCodesProvider()

private function getEventMock($response)
{
$mock = $this->getMockBuilder('Guzzle\Common\Event')
$mock = $this->getMockBuilder('GuzzleHttp\Event\AbstractRequestEvent')
->getMock();
$request = $this->getMockBuilder('Guzzle\Http\Message\Request')
$request = $this->getMockBuilder('GuzzleHttp\Message\Request')
->disableOriginalConstructor()
->getMock();
$request->expects($this->any())
Expand All @@ -145,7 +145,7 @@ private function createResponseMock(
$httpStatusCode,
$responseBody = ''
) {
$mock = $this->getMockBuilder('Guzzle\Http\Message\Response')
$mock = $this->getMockBuilder('GuzzleHttp\Message\Response')
->disableOriginalConstructor()
->getMock();
$mock->expects($this->once())
Expand Down

0 comments on commit 1ad104a

Please sign in to comment.