From 1022203dcec833f3f4cb5dcea474b93c5cde3214 Mon Sep 17 00:00:00 2001 From: peter279k Date: Wed, 25 Sep 2019 00:58:06 +0800 Subject: [PATCH] Changing into magic class call instead --- tests/ClientTest.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 81d996a..d996c49 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -2,6 +2,8 @@ namespace Shutterstock\Api; +use GuzzleHttp\Promise\PromiseInterface; +use Psr\Http\Message\ResponseInterface; use GuzzleHttp\Client as Guzzle; use GuzzleHttp\HandlerStack; use GuzzleHttp\Middleware; @@ -20,7 +22,7 @@ public function testIsInstanceOfClient() $client = $this->getClient(); $this->assertInstanceOf( - 'Shutterstock\Api\Client', + Client::class, $client ); } @@ -30,7 +32,7 @@ public function testConstructSetsGuzzle() $client = $this->getClient(); $this->assertAttributeInstanceOf( - 'GuzzleHttp\Client', + Guzzle::class, 'guzzle', $client ); @@ -71,7 +73,7 @@ public function testGet($expectedUri, $uri, $query) $response = $client->get($uri, $query); $lastRequest = $mockHandler->getLastRequest(); - $this->assertInstanceOf('Psr\Http\Message\ResponseInterface', $response); + $this->assertInstanceOf(ResponseInterface::class, $response); $this->assertEquals('GET', $lastRequest->getMethod()); $this->assertEquals($expectedUri, (string) $lastRequest->getUri()); } @@ -88,7 +90,7 @@ public function testGetAsync($expectedUri, $uri, $query) $promise = $client->getAsync($uri, $query); $lastRequest = $mockHandler->getLastRequest(); - $this->assertInstanceOf('GuzzleHttp\Promise\PromiseInterface', $promise); + $this->assertInstanceOf(PromiseInterface::class, $promise); $this->assertEquals('GET', $lastRequest->getMethod()); $this->assertEquals($expectedUri, (string) $lastRequest->getUri()); } @@ -158,7 +160,7 @@ public function testPost($expectedUri, $expectedBody, $uri, $body) $response = $client->post($uri, $body); $lastRequest = $mockHandler->getLastRequest(); - $this->assertInstanceOf('Psr\Http\Message\ResponseInterface', $response); + $this->assertInstanceOf(ResponseInterface::class, $response); $this->assertEquals('POST', $lastRequest->getMethod()); $this->assertEquals($expectedUri, (string) $lastRequest->getUri()); $this->assertEquals($expectedBody, (string) $lastRequest->getBody()); @@ -176,7 +178,7 @@ public function testPostAsync($expectedUri, $expectedBody, $uri, $body) $promise = $client->postAsync($uri, $body); $lastRequest = $mockHandler->getLastRequest(); - $this->assertInstanceOf('GuzzleHttp\Promise\PromiseInterface', $promise); + $this->assertInstanceOf(PromiseInterface::class, $promise); $this->assertEquals('POST', $lastRequest->getMethod()); $this->assertEquals($expectedUri, (string) $lastRequest->getUri()); $this->assertEquals($expectedBody, (string) $lastRequest->getBody());