diff --git a/.travis.yml b/.travis.yml index 7bb93d8fcbb..4274b4dee75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ matrix: - php: 7.2 name: Backward compatibillity check env: DEPENDENCIES="roave/backward-compatibility-check" TEST_COMMAND="./.github/bc-test.sh" - - php: 7.1 + - php: 7.4 name: phpstan script: - vendor/bin/phpstan analyse --no-progress diff --git a/README.md b/README.md index 47ff1282522..1bf8be42c06 100644 --- a/README.md +++ b/README.md @@ -20,24 +20,34 @@ Uses [GitHub API v3](http://developer.github.com/v3/) & supports [GitHub API v4] ## Requirements * PHP >= 7.1 -* A [HTTP client](https://packagist.org/providers/php-http/client-implementation) +* A [HTTP client](https://packagist.org/providers/psr/http-client-implementation) * A [PSR-7 implementation](https://packagist.org/providers/psr/http-message-implementation) * (optional) PHPUnit to run tests. ## Install -Via Composer: +Via [Composer](https://getcomposer.org). + +### PHP 7.2+: ```bash -$ composer require knplabs/github-api php-http/guzzle6-adapter "^1.1" +composer require knplabs/github-api guzzlehttp/guzzle:^7.0.1 ``` -Why `php-http/guzzle6-adapter`? We are decoupled from any HTTP messaging client with help by [HTTPlug](http://httplug.io/). Read about clients in our [docs](doc/customize.md). +### PHP 7.1+: + +```bash +composer require knplabs/github-api php-http/guzzle6-adapter:^2.0.1 +``` +### Laravel 5.5+: + +```bash +composer require graham-campbell/github guzzlehttp/guzzle:^7.0.1 +``` -## Using Laravel? +We are decoupled from any HTTP messaging client with help by [HTTPlug](http://httplug.io). Read about clients in our [docs](doc/customize.md). [graham-campbell/github](https://github.com/GrahamCampbell/Laravel-GitHub) is by [Graham Campbell](https://github.com/GrahamCampbell). -[Laravel GitHub](https://github.com/GrahamCampbell/Laravel-GitHub) by [Graham Campbell](https://github.com/GrahamCampbell) might interest you. ## Basic usage of `php-github-api` client diff --git a/composer.json b/composer.json index b49d5cdb0ec..3417cad716a 100644 --- a/composer.json +++ b/composer.json @@ -18,17 +18,17 @@ ], "require": { "php": "^7.1", - "psr/http-message": "^1.0", + "php-http/client-common": "^2.1", + "php-http/cache-plugin": "^1.7", + "php-http/discovery": "^1.7", + "php-http/httplug": "^2.1", "psr/cache": "^1.0", - "php-http/httplug": "^1.1 || ^2.0", - "php-http/discovery": "^1.0", - "php-http/client-implementation": "^1.0", - "php-http/client-common": "^1.6 || ^2.0", - "php-http/cache-plugin": "^1.4" + "psr/http-client-implementation": "^1.0", + "psr/http-message": "^1.0" }, "require-dev": { "phpunit/phpunit": "^7.0 || ^8.0", - "php-http/guzzle6-adapter": "^1.0 || ^2.0", + "php-http/guzzle6-adapter": "^2.0", "php-http/mock-client": "^1.2", "guzzlehttp/psr7": "^1.2", "cache/array-adapter": "^0.4", diff --git a/lib/Github/Api/AbstractApi.php b/lib/Github/Api/AbstractApi.php index a9204787659..9435d8cd530 100644 --- a/lib/Github/Api/AbstractApi.php +++ b/lib/Github/Api/AbstractApi.php @@ -232,7 +232,7 @@ protected function delete($path, array $parameters = [], array $requestHeaders = * * @param array $parameters Request parameters * - * @return null|string + * @return string|null */ protected function createJsonBody(array $parameters) { diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index 63fd0358df7..02cb02d1454 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -183,7 +183,7 @@ public function showById($id) * @param string $description repository description * @param string $homepage homepage url * @param bool $public `true` for public, `false` for private - * @param null|string $organization username of organization if applicable + * @param string|null $organization username of organization if applicable * @param bool $hasIssues `true` to enable issues for this repository, `false` to disable them * @param bool $hasWiki `true` to enable the wiki for this repository, `false` to disable it * @param bool $hasDownloads `true` to enable downloads for this repository, `false` to disable them diff --git a/lib/Github/Api/Repository/Contents.php b/lib/Github/Api/Repository/Contents.php index 2cd11ddbc6f..98c85723c2f 100644 --- a/lib/Github/Api/Repository/Contents.php +++ b/lib/Github/Api/Repository/Contents.php @@ -45,7 +45,7 @@ public function configure($bodyType = null) * * @param string $username the user who owns the repository * @param string $repository the name of the repository - * @param null|string $reference reference to a branch or commit + * @param string|null $reference reference to a branch or commit * * @return array information for README file */ @@ -63,8 +63,8 @@ public function readme($username, $repository, $reference = null) * * @param string $username the user who owns the repository * @param string $repository the name of the repository - * @param null|string $path path to file or directory - * @param null|string $reference reference to a branch or commit + * @param string|null $path path to file or directory + * @param string|null $reference reference to a branch or commit * * @return array|string information for file | information for each item in directory */ @@ -90,7 +90,7 @@ public function show($username, $repository, $path = null, $reference = null) * @param string $path path to file * @param string $content contents of the new file * @param string $message the commit message - * @param null|string $branch name of a branch + * @param string|null $branch name of a branch * @param null|array $committer information about the committer * * @throws MissingArgumentException @@ -126,7 +126,7 @@ public function create($username, $repository, $path, $content, $message, $branc * @param string $username the user who owns the repository * @param string $repository the name of the repository * @param string $path path of file to check - * @param null|string $reference reference to a branch or commit + * @param string|null $reference reference to a branch or commit * * @return bool */ @@ -166,7 +166,7 @@ public function exists($username, $repository, $path, $reference = null) * @param string $content contents of the new file * @param string $message the commit message * @param string $sha blob SHA of the file being replaced - * @param null|string $branch name of a branch + * @param string|null $branch name of a branch * @param null|array $committer information about the committer * * @throws MissingArgumentException @@ -207,7 +207,7 @@ public function update($username, $repository, $path, $content, $message, $sha, * @param string $path path to file * @param string $message the commit message * @param string $sha blob SHA of the file being deleted - * @param null|string $branch name of a branch + * @param string|null $branch name of a branch * @param null|array $committer information about the committer * * @throws MissingArgumentException @@ -245,7 +245,7 @@ public function rm($username, $repository, $path, $message, $sha, $branch = null * @param string $username the user who owns the repository * @param string $repository the name of the repository * @param string $format format of archive: tarball or zipball - * @param null|string $reference reference to a branch or commit + * @param string|null $reference reference to a branch or commit * * @return string repository archive binary data */ @@ -265,12 +265,12 @@ public function archive($username, $repository, $format, $reference = null) * @param string $username the user who owns the repository * @param string $repository the name of the repository * @param string $path path to file - * @param null|string $reference reference to a branch or commit + * @param string|null $reference reference to a branch or commit * * @throws InvalidArgumentException If $path is not a file or if its encoding is different from base64 * @throws ErrorException If $path doesn't include a 'content' index * - * @return null|string content of file, or null in case of base64_decode failure + * @return string|null content of file, or null in case of base64_decode failure */ public function download($username, $repository, $path, $reference = null) { diff --git a/lib/Github/Client.php b/lib/Github/Client.php index 2052461335d..09f62c422d8 100644 --- a/lib/Github/Client.php +++ b/lib/Github/Client.php @@ -12,9 +12,9 @@ use Github\HttpClient\Plugin\PathPrepend; use Http\Client\Common\HttpMethodsClient; use Http\Client\Common\Plugin; -use Http\Client\HttpClient; use Http\Discovery\UriFactoryDiscovery; use Psr\Cache\CacheItemPoolInterface; +use Psr\Http\Client\ClientInterface; /** * Simple yet very cool PHP GitHub client. @@ -161,13 +161,13 @@ public function __construct(Builder $httpClientBuilder = null, $apiVersion = nul } /** - * Create a Github\Client using a HttpClient. + * Create a Github\Client using a HTTP client. * - * @param HttpClient $httpClient + * @param ClientInterface $httpClient * * @return Client */ - public static function createWithHttpClient(HttpClient $httpClient) + public static function createWithHttpClient(ClientInterface $httpClient) { $builder = new Builder($httpClient); @@ -329,8 +329,8 @@ public function api($name) * Authenticate a user for all next requests. * * @param string $tokenOrLogin GitHub private token/username/client ID - * @param null|string $password GitHub password/secret (optionally can contain $authMethod) - * @param null|string $authMethod One of the AUTH_* class constants + * @param string|null $password GitHub password/secret (optionally can contain $authMethod) + * @param string|null $authMethod One of the AUTH_* class constants * * @throws InvalidArgumentException If no authentication method was given */ diff --git a/lib/Github/HttpClient/Builder.php b/lib/Github/HttpClient/Builder.php index 3b05b8fecc5..e68edc738d4 100644 --- a/lib/Github/HttpClient/Builder.php +++ b/lib/Github/HttpClient/Builder.php @@ -6,13 +6,13 @@ use Http\Client\Common\Plugin; use Http\Client\Common\Plugin\Cache\Generator\HeaderCacheKeyGenerator; use Http\Client\Common\PluginClientFactory; -use Http\Client\HttpClient; -use Http\Discovery\HttpClientDiscovery; use Http\Discovery\MessageFactoryDiscovery; +use Http\Discovery\Psr18ClientDiscovery; use Http\Discovery\StreamFactoryDiscovery; use Http\Message\RequestFactory; use Http\Message\StreamFactory; use Psr\Cache\CacheItemPoolInterface; +use Psr\Http\Client\ClientInterface; /** * A builder that builds the API client. @@ -25,7 +25,7 @@ class Builder /** * The object that sends HTTP messages. * - * @var HttpClient + * @var ClientInterface */ private $httpClient; @@ -73,16 +73,16 @@ class Builder private $headers = []; /** - * @param HttpClient $httpClient - * @param RequestFactory $requestFactory - * @param StreamFactory $streamFactory + * @param ClientInterface $httpClient + * @param RequestFactory $requestFactory + * @param StreamFactory $streamFactory */ public function __construct( - HttpClient $httpClient = null, + ClientInterface $httpClient = null, RequestFactory $requestFactory = null, StreamFactory $streamFactory = null ) { - $this->httpClient = $httpClient ?: HttpClientDiscovery::find(); + $this->httpClient = $httpClient ?: Psr18ClientDiscovery::find(); $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find(); $this->streamFactory = $streamFactory ?: StreamFactoryDiscovery::find(); } diff --git a/lib/Github/HttpClient/Message/ResponseMediator.php b/lib/Github/HttpClient/Message/ResponseMediator.php index dcab5b4a979..2082fb288fa 100644 --- a/lib/Github/HttpClient/Message/ResponseMediator.php +++ b/lib/Github/HttpClient/Message/ResponseMediator.php @@ -52,7 +52,7 @@ public static function getPagination(ResponseInterface $response) /** * @param ResponseInterface $response * - * @return null|string + * @return string|null */ public static function getApiLimit(ResponseInterface $response) { diff --git a/lib/Github/HttpClient/Plugin/Authentication.php b/lib/Github/HttpClient/Plugin/Authentication.php index de6237bef8b..5336a0140c2 100644 --- a/lib/Github/HttpClient/Plugin/Authentication.php +++ b/lib/Github/HttpClient/Plugin/Authentication.php @@ -5,6 +5,7 @@ use Github\Client; use Github\Exception\RuntimeException; use Http\Client\Common\Plugin; +use Http\Promise\Promise; use Psr\Http\Message\RequestInterface; /** @@ -14,12 +15,26 @@ */ class Authentication implements Plugin { - use Plugin\VersionBridgePlugin; - + /** + * @var string + */ private $tokenOrLogin; + + /** + * @var string|null + */ private $password; + + /** + * @var string|null + */ private $method; + /** + * @param string $tokenOrLogin GitHub private token/username/client ID + * @param string|null $password GitHub password/secret (optionally can contain $method) + * @param string|null $method One of the AUTH_* class constants + */ public function __construct($tokenOrLogin, $password, $method) { $this->tokenOrLogin = $tokenOrLogin; @@ -30,7 +45,7 @@ public function __construct($tokenOrLogin, $password, $method) /** * {@inheritdoc} */ - public function doHandleRequest(RequestInterface $request, callable $next, callable $first) + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise { switch ($this->method) { case Client::AUTH_HTTP_PASSWORD: diff --git a/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php b/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php index dde0b45ccff..1e470301c77 100644 --- a/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php +++ b/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php @@ -9,6 +9,7 @@ use Github\Exception\ValidationFailedException; use Github\HttpClient\Message\ResponseMediator; use Http\Client\Common\Plugin; +use Http\Promise\Promise; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -18,12 +19,10 @@ */ class GithubExceptionThrower implements Plugin { - use Plugin\VersionBridgePlugin; - /** * {@inheritdoc} */ - public function doHandleRequest(RequestInterface $request, callable $next, callable $first) + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise { return $next($request)->then(function (ResponseInterface $response) use ($request) { if ($response->getStatusCode() < 400 || $response->getStatusCode() > 600) { diff --git a/lib/Github/HttpClient/Plugin/History.php b/lib/Github/HttpClient/Plugin/History.php index 0f59bbb65f9..4967bfe595d 100644 --- a/lib/Github/HttpClient/Plugin/History.php +++ b/lib/Github/HttpClient/Plugin/History.php @@ -3,6 +3,7 @@ namespace Github\HttpClient\Plugin; use Http\Client\Common\Plugin\Journal; +use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -13,10 +14,8 @@ */ class History implements Journal { - use HistoryTrait; - /** - * @var ResponseInterface + * @var ResponseInterface|null */ private $lastResponse; @@ -32,4 +31,8 @@ public function addSuccess(RequestInterface $request, ResponseInterface $respons { $this->lastResponse = $response; } + + public function addFailure(RequestInterface $request, ClientExceptionInterface $exception) + { + } } diff --git a/lib/Github/HttpClient/Plugin/HistoryTrait.php b/lib/Github/HttpClient/Plugin/HistoryTrait.php deleted file mode 100644 index fbc5335d318..00000000000 --- a/lib/Github/HttpClient/Plugin/HistoryTrait.php +++ /dev/null @@ -1,32 +0,0 @@ -getUri()->getPath(); if (strpos($currentPath, $this->path) !== 0) { diff --git a/test/Github/Tests/Api/TestCase.php b/test/Github/Tests/Api/TestCase.php index d240f246d48..4fd6a49234c 100644 --- a/test/Github/Tests/Api/TestCase.php +++ b/test/Github/Tests/Api/TestCase.php @@ -2,6 +2,8 @@ namespace Github\Tests\Api; +use Github\Client; +use Psr\Http\Client\ClientInterface; use ReflectionMethod; abstract class TestCase extends \PHPUnit\Framework\TestCase @@ -16,14 +18,14 @@ abstract protected function getApiClass(); */ protected function getApiMock() { - $httpClient = $this->getMockBuilder(\Http\Client\HttpClient::class) + $httpClient = $this->getMockBuilder(ClientInterface::class) ->setMethods(['sendRequest']) ->getMock(); $httpClient ->expects($this->any()) ->method('sendRequest'); - $client = \Github\Client::createWithHttpClient($httpClient); + $client = Client::createWithHttpClient($httpClient); return $this->getMockBuilder($this->getApiClass()) ->setMethods(['get', 'post', 'postRaw', 'patch', 'delete', 'put', 'head']) diff --git a/test/Github/Tests/ClientTest.php b/test/Github/Tests/ClientTest.php index 550bc8169f6..15a6bf401ac 100644 --- a/test/Github/Tests/ClientTest.php +++ b/test/Github/Tests/ClientTest.php @@ -9,7 +9,7 @@ use Github\HttpClient\Builder; use Github\HttpClient\Plugin\Authentication; use GuzzleHttp\Psr7\Response; -use Http\Client\HttpClient; +use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestInterface; class ClientTest extends \PHPUnit\Framework\TestCase @@ -21,7 +21,7 @@ public function shouldNotHaveToPassHttpClientToConstructor() { $client = new Client(); - $this->assertInstanceOf(\Http\Client\HttpClient::class, $client->getHttpClient()); + $this->assertInstanceOf(ClientInterface::class, $client->getHttpClient()); } /** @@ -29,12 +29,12 @@ public function shouldNotHaveToPassHttpClientToConstructor() */ public function shouldPassHttpClientInterfaceToConstructor() { - $httpClientMock = $this->getMockBuilder(\Http\Client\HttpClient::class) + $httpClientMock = $this->getMockBuilder(ClientInterface::class) ->getMock(); $client = Client::createWithHttpClient($httpClientMock); - $this->assertInstanceOf(\Http\Client\HttpClient::class, $client->getHttpClient()); + $this->assertInstanceOf(ClientInterface::class, $client->getHttpClient()); } /** @@ -43,7 +43,7 @@ public function shouldPassHttpClientInterfaceToConstructor() */ public function shouldAuthenticateUsingAllGivenParameters($login, $password, $method) { - $builder = $this->getMockBuilder(\Github\HttpClient\Builder::class) + $builder = $this->getMockBuilder(Builder::class) ->setMethods(['addPlugin', 'removePlugin']) ->disableOriginalConstructor() ->getMock(); @@ -84,7 +84,7 @@ public function getAuthenticationFullData() */ public function shouldAuthenticateUsingGivenParameters($token, $method) { - $builder = $this->getMockBuilder(\Github\HttpClient\Builder::class) + $builder = $this->getMockBuilder(Builder::class) ->setMethods(['addPlugin', 'removePlugin']) ->getMock(); $builder->expects($this->once()) @@ -217,7 +217,7 @@ public function getApiClassesProvider() */ public function testEnterpriseUrl() { - $httpClientMock = $this->getMockBuilder(HttpClient::class) + $httpClientMock = $this->getMockBuilder(ClientInterface::class) ->setMethods(['sendRequest']) ->getMock(); diff --git a/test/Github/Tests/HttpClient/Plugin/AuthenticationTest.php b/test/Github/Tests/HttpClient/Plugin/AuthenticationTest.php index bf9f64e1af9..bcff0d8df88 100644 --- a/test/Github/Tests/HttpClient/Plugin/AuthenticationTest.php +++ b/test/Github/Tests/HttpClient/Plugin/AuthenticationTest.php @@ -5,6 +5,7 @@ use Github\Client; use Github\HttpClient\Plugin\Authentication; use GuzzleHttp\Psr7\Request; +use Http\Promise\FulfilledPromise; use PHPUnit\Framework\TestCase; class AuthenticationTest extends TestCase @@ -19,9 +20,11 @@ public function testAuthenticationMethods($tokenOrLogin, $password, $method, $ex /** @var Request $newRequest */ $newRequest = null; - $plugin->doHandleRequest($request, static function ($request) use (&$newRequest) { + $plugin->handleRequest($request, static function ($request) use (&$newRequest) { /** @var Request $newRequest */ $newRequest = $request; + + return new FulfilledPromise('FOO'); }, static function () { throw new \RuntimeException('Did not expect plugin to call first'); }); diff --git a/test/Github/Tests/HttpClient/Plugin/GithubExceptionThrowerTest.php b/test/Github/Tests/HttpClient/Plugin/GithubExceptionThrowerTest.php index 32be44ce1d5..8a3f788b664 100644 --- a/test/Github/Tests/HttpClient/Plugin/GithubExceptionThrowerTest.php +++ b/test/Github/Tests/HttpClient/Plugin/GithubExceptionThrowerTest.php @@ -4,8 +4,9 @@ use Github\Exception\ExceptionInterface; use Github\HttpClient\Plugin\GithubExceptionThrower; -use GuzzleHttp\Promise\FulfilledPromise; use GuzzleHttp\Psr7\Response; +use Http\Client\Promise\HttpFulfilledPromise; +use Http\Client\Promise\HttpRejectedPromise; use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -25,22 +26,11 @@ public function testHandleRequest(ResponseInterface $response, ExceptionInterfac /** @var RequestInterface $request */ $request = $this->getMockForAbstractClass(RequestInterface::class); - $promise = $this->getMockBuilder(FulfilledPromise::class)->disableOriginalConstructor()->getMock(); - $promise->expects($this->once()) - ->method('then') - ->willReturnCallback(function ($callback) use ($response) { - return $callback($response); - }); + $promise = new HttpFulfilledPromise($response); $plugin = new GithubExceptionThrower(); - if ($exception) { - $this->expectException(get_class($exception)); - $this->expectExceptionCode($exception->getCode()); - $this->expectExceptionMessage($exception->getMessage()); - } - - $plugin->doHandleRequest( + $result = $plugin->handleRequest( $request, function (RequestInterface $request) use ($promise) { return $promise; @@ -49,6 +39,20 @@ function (RequestInterface $request) use ($promise) { return $promise; } ); + + if ($exception) { + $this->assertInstanceOf(HttpRejectedPromise::class, $result); + } else { + $this->assertInstanceOf(HttpFulfilledPromise::class, $result); + } + + if ($exception) { + $this->expectException(get_class($exception)); + $this->expectExceptionCode($exception->getCode()); + $this->expectExceptionMessage($exception->getMessage()); + } + + $result->wait(); } /** diff --git a/test/Github/Tests/HttpClient/Plugin/PathPrependTest.php b/test/Github/Tests/HttpClient/Plugin/PathPrependTest.php index e5feda2cf3d..f5d4052d94d 100644 --- a/test/Github/Tests/HttpClient/Plugin/PathPrependTest.php +++ b/test/Github/Tests/HttpClient/Plugin/PathPrependTest.php @@ -4,6 +4,7 @@ use Github\HttpClient\Plugin\PathPrepend; use GuzzleHttp\Psr7\Request; +use Http\Promise\FulfilledPromise; use PHPUnit\Framework\TestCase; /** @@ -20,8 +21,10 @@ public function testPathIsPrepended($uri, $expectedPath) $plugin = new PathPrepend('/api/v3'); $newRequest = null; - $plugin->doHandleRequest($request, function ($request) use (&$newRequest) { + $plugin->handleRequest($request, function ($request) use (&$newRequest) { $newRequest = $request; + + return new FulfilledPromise('FOO'); }, function () { throw new \RuntimeException('Did not expect plugin to call first'); }); diff --git a/test/Github/Tests/ResultPagerTest.php b/test/Github/Tests/ResultPagerTest.php index a105a84f054..e8892501d44 100644 --- a/test/Github/Tests/ResultPagerTest.php +++ b/test/Github/Tests/ResultPagerTest.php @@ -2,11 +2,13 @@ namespace Github\Tests; +use Github\Api\ApiInterface; use Github\Api\Organization\Members; use Github\Api\Search; use Github\ResultPager; use Github\Tests\Mock\PaginatedResponse; use Http\Client\HttpClient; +use Psr\Http\Client\ClientInterface; /** * ResultPagerTest. @@ -29,7 +31,7 @@ public function shouldGetAllResults() $response = new PaginatedResponse($amountLoops, $content); // httpClient mock - $httpClientMock = $this->getMockBuilder(\Http\Client\HttpClient::class) + $httpClientMock = $this->getMockBuilder(ClientInterface::class) ->setMethods(['sendRequest']) ->getMock(); $httpClientMock @@ -76,7 +78,7 @@ public function shouldGetAllSearchResults() $response = new PaginatedResponse($amountLoops, $content); // httpClient mock - $httpClientMock = $this->getMockBuilder(\Http\Client\HttpClient::class) + $httpClientMock = $this->getMockBuilder(ClientInterface::class) ->setMethods(['sendRequest']) ->getMock(); $httpClientMock @@ -99,10 +101,10 @@ public function testFetch() $result = 'foo'; $method = 'bar'; $parameters = ['baz']; - $api = $this->getMockBuilder(\Github\Api\ApiInterface::class) + $api = $this->getMockBuilder(ApiInterface::class) ->getMock(); - $paginator = $this->getMockBuilder(\Github\ResultPager::class) + $paginator = $this->getMockBuilder(ResultPager::class) ->disableOriginalConstructor() ->setMethods(['callApi', 'postFetch']) ->getMock();