From b6789a3a9cfdfce89e9025beff2bd222d3ff2caf Mon Sep 17 00:00:00 2001 From: Stephan Vock Date: Sun, 27 Nov 2022 10:59:35 +0000 Subject: [PATCH] PHPStan: fix first batch of level 6 issues --- lib/Bitbucket/API/Api.php | 6 ++- lib/Bitbucket/API/Http/Client.php | 13 +++--- .../API/Http/HttpPluginClientBuilder.php | 9 ++++- .../Http/Plugin/ApiOneCollectionPlugin.php | 3 ++ .../API/Http/Plugin/HistoryPlugin.php | 2 +- .../API/Http/Plugin/HistoryVersionBridge.php | 4 +- .../API/Http/Plugin/NormalizeArrayPlugin.php | 1 + .../API/Repositories/BranchRestrictions.php | 1 + phpstan.neon | 7 +++- test/Bitbucket/Tests/API/ApiTest.php | 25 +++++++----- .../Tests/API/GroupPrivilegesTest.php | 14 +++---- .../Tests/API/Groups/MembersTest.php | 6 +-- test/Bitbucket/Tests/API/GroupsTest.php | 12 +++--- test/Bitbucket/Tests/API/Http/ClientTest.php | 37 ++++++++--------- .../Plugin/ApiOneCollectionPluginTest.php | 8 ++-- .../Http/Plugin/NormalizeArrayPluginTest.php | 2 +- .../Tests/API/Http/Response/PagerTest.php | 26 ++++++------ test/Bitbucket/Tests/API/InvitationsTest.php | 2 +- .../Repositories/BranchRestrictionsTest.php | 30 +++++++------- .../Commits/BuildStatusesTest.php | 6 +-- .../API/Repositories/Commits/CommentsTest.php | 4 +- .../Tests/API/Repositories/CommitsTest.php | 12 +++--- .../Tests/API/Repositories/DeploykeysTest.php | 14 +++---- .../Tests/API/Repositories/HooksTest.php | 20 +++++----- .../API/Repositories/Issues/CommentsTest.php | 12 +++--- .../Tests/API/Repositories/IssuesTest.php | 20 +++++----- .../Tests/API/Repositories/MilestonesTest.php | 8 ++-- .../API/Repositories/Pipelines/StepsTest.php | 6 +-- .../Tests/API/Repositories/PipelinesTest.php | 12 +++--- .../PullRequests/CommentsTest.php | 10 ++--- .../API/Repositories/PullRequestsTest.php | 40 ++++++++++--------- .../API/Repositories/Refs/BranchesTest.php | 16 ++++---- .../Tests/API/Repositories/Refs/TagsTest.php | 16 ++++---- .../Tests/API/Repositories/RefsTest.php | 8 ++-- .../Tests/API/Repositories/RepositoryTest.php | 34 ++++++++-------- .../Tests/API/Repositories/SrcTest.php | 16 ++++---- test/Bitbucket/Tests/API/RepositoriesTest.php | 2 +- test/Bitbucket/Tests/API/Teams/HooksTest.php | 16 ++++---- .../Tests/API/Teams/PermissionsTest.php | 6 +-- test/Bitbucket/Tests/API/TeamsTest.php | 21 +++++----- test/Bitbucket/Tests/API/TestCase.php | 23 +++++++---- .../Tests/API/User/PermissionsTest.php | 4 +- test/Bitbucket/Tests/API/UserTest.php | 8 ++-- .../Tests/API/Users/InvitationsTest.php | 8 ++-- .../Bitbucket/Tests/API/Users/SshKeysTest.php | 20 +++++----- test/Bitbucket/Tests/API/UsersTest.php | 8 ++-- .../Tests/API/Workspaces/HooksTest.php | 4 +- .../Tests/API/Workspaces/WorkspaceTest.php | 8 ++-- test/Bitbucket/Tests/API/WorkspacesTest.php | 2 +- 49 files changed, 318 insertions(+), 274 deletions(-) diff --git a/lib/Bitbucket/API/Api.php b/lib/Bitbucket/API/Api.php index 8abfb87..40fb818 100644 --- a/lib/Bitbucket/API/Api.php +++ b/lib/Bitbucket/API/Api.php @@ -21,6 +21,7 @@ /** * @author Alexandru Guzinschi + * @phpstan-import-type OptionalClientOption from Client */ class Api { @@ -41,7 +42,7 @@ class Api protected $httpClient; /** - * @param array $options + * @param OptionalClientOption $options * @param ClientInterface $client */ public function __construct(array $options = array(), ClientInterface $client = null) @@ -84,6 +85,9 @@ public function setCredentials(Authentication $authentication) $this->addPlugin(new AuthenticationPlugin($authentication)); } + /** + * @return void + */ public function addPlugin(Plugin $plugin) { $this->httpClient->getClientBuilder()->removePlugin(get_class($plugin)); diff --git a/lib/Bitbucket/API/Http/Client.php b/lib/Bitbucket/API/Http/Client.php index f0bfcac..613b92d 100644 --- a/lib/Bitbucket/API/Http/Client.php +++ b/lib/Bitbucket/API/Http/Client.php @@ -21,12 +21,12 @@ /** * @author Alexandru G. + * @phpstan-type ClientOption array{base_url: string, api_version: string, api_versions: string[], format: string, formats: string[], user_agent: string, timeout: int, verify_peer: bool} + * @phpstan-type OptionalClientOption array{base_url?: string, api_version?: string, api_versions?: string[], format?: string, formats?: string[], user_agent?: string, timeout?: int, verify_peer?: bool} */ class Client implements ClientInterface { - /** - * @var array - */ + /** @var ClientOption */ protected $options = array( 'base_url' => 'https://api.bitbucket.org', 'api_version' => '2.0', @@ -45,6 +45,9 @@ class Client implements ClientInterface /** @var HistoryPlugin */ private $responseHistory; + /** + * @param OptionalClientOption $options + */ public function __construct(array $options = array(), HttpPluginClientBuilder $httpClientBuilder = null) { $this->responseHistory = new HistoryPlugin(); @@ -214,11 +217,11 @@ public function setApiVersion($version) */ public function isApiVersion($version) { - return abs($this->options['api_version'] - $version) < 0.00001; + return (float) $version === (float) $this->options['api_version']; } /** - * {@inheritdoc} + * @return string */ public function getApiBaseUrl() { diff --git a/lib/Bitbucket/API/Http/HttpPluginClientBuilder.php b/lib/Bitbucket/API/Http/HttpPluginClientBuilder.php index 85b2709..6e349a5 100644 --- a/lib/Bitbucket/API/Http/HttpPluginClientBuilder.php +++ b/lib/Bitbucket/API/Http/HttpPluginClientBuilder.php @@ -28,6 +28,9 @@ public function __construct(HttpClient $httpClient = null, MessageFactory $messa $this->messageFactory = $messageFactory ?: MessageFactoryDiscovery::find(); } + /** + * @return void + */ public function addPlugin(Plugin $plugin) { if ($plugin instanceof ApiVersionPlugin) { @@ -40,7 +43,8 @@ public function addPlugin(Plugin $plugin) } /** - * @param string $pluginClass + * @param class-string $pluginClass + * @return void */ public function removePlugin($pluginClass) { @@ -82,6 +86,9 @@ public function getHttpClient() return $this->pluginClient; } + /** + * @return MessageFactory + */ public function getMessageFactory() { return $this->messageFactory; diff --git a/lib/Bitbucket/API/Http/Plugin/ApiOneCollectionPlugin.php b/lib/Bitbucket/API/Http/Plugin/ApiOneCollectionPlugin.php index 242aaeb..f152058 100644 --- a/lib/Bitbucket/API/Http/Plugin/ApiOneCollectionPlugin.php +++ b/lib/Bitbucket/API/Http/Plugin/ApiOneCollectionPlugin.php @@ -45,6 +45,9 @@ public function __construct(ResponseFactory $responseFactory = null) $this->responseFactory = $responseFactory ?: MessageFactoryDiscovery::find(); } + /** + * @return callable + */ protected function doHandleRequest(RequestInterface $request, callable $next, callable $first) { return $next($request)->then(function (ResponseInterface $response) use ($request) { diff --git a/lib/Bitbucket/API/Http/Plugin/HistoryPlugin.php b/lib/Bitbucket/API/Http/Plugin/HistoryPlugin.php index f4b6827..367eb22 100644 --- a/lib/Bitbucket/API/Http/Plugin/HistoryPlugin.php +++ b/lib/Bitbucket/API/Http/Plugin/HistoryPlugin.php @@ -31,7 +31,7 @@ public function getLastResponse() return $this->lastResponse; } - public function addSuccess(RequestInterface $request, ResponseInterface $response) + public function addSuccess(RequestInterface $request, ResponseInterface $response): void { $this->lastRequest = $request; $this->lastResponse = $response; diff --git a/lib/Bitbucket/API/Http/Plugin/HistoryVersionBridge.php b/lib/Bitbucket/API/Http/Plugin/HistoryVersionBridge.php index 3d08064..83fd658 100644 --- a/lib/Bitbucket/API/Http/Plugin/HistoryVersionBridge.php +++ b/lib/Bitbucket/API/Http/Plugin/HistoryVersionBridge.php @@ -10,7 +10,7 @@ trait HistoryVersionBridge { // History method for php-http/client-common 2 - public function addFailure(RequestInterface $request, ClientExceptionInterface $exception) + public function addFailure(RequestInterface $request, ClientExceptionInterface $exception): void { } } @@ -18,7 +18,7 @@ public function addFailure(RequestInterface $request, ClientExceptionInterface $ trait HistoryVersionBridge { // History method for php-http/client-common 1 - public function addFailure(RequestInterface $request, Exception $exception) + public function addFailure(RequestInterface $request, Exception $exception): void { } } diff --git a/lib/Bitbucket/API/Http/Plugin/NormalizeArrayPlugin.php b/lib/Bitbucket/API/Http/Plugin/NormalizeArrayPlugin.php index f57bb68..fb442cb 100644 --- a/lib/Bitbucket/API/Http/Plugin/NormalizeArrayPlugin.php +++ b/lib/Bitbucket/API/Http/Plugin/NormalizeArrayPlugin.php @@ -32,6 +32,7 @@ class NormalizeArrayPlugin implements Plugin /** * {@inheritDoc} + * @return callable */ protected function doHandleRequest(RequestInterface $request, callable $next, callable $first) { diff --git a/lib/Bitbucket/API/Repositories/BranchRestrictions.php b/lib/Bitbucket/API/Repositories/BranchRestrictions.php index e9be16f..729145f 100644 --- a/lib/Bitbucket/API/Repositories/BranchRestrictions.php +++ b/lib/Bitbucket/API/Repositories/BranchRestrictions.php @@ -164,6 +164,7 @@ public function delete($account, $repo, $id) * Add allowed permission types * * @param array $restrictions + * @return void */ public function addAllowedRestrictionType($restrictions = array()) { diff --git a/phpstan.neon b/phpstan.neon index d2dc39f..be35fc7 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,10 @@ parameters: - level: 5 + level: 6 paths: - lib - test + + ignoreErrors: + - '#Method Bitbucket\\[a-z\\]+(TestCase|Test)::[a-z0-9]*provider[a-z0-9]*\(\) return type has no value type specified in iterable type#i' + - '#Method Bitbucket\\[a-z\\]+Test::test[a-z0-9]*\(\) has parameter \$[a-z0-9]+ with no value type specified in iterable type#i' + - '#no value type specified in iterable type array#' diff --git a/test/Bitbucket/Tests/API/ApiTest.php b/test/Bitbucket/Tests/API/ApiTest.php index 2e34421..f86e9a0 100644 --- a/test/Bitbucket/Tests/API/ApiTest.php +++ b/test/Bitbucket/Tests/API/ApiTest.php @@ -7,13 +7,13 @@ class ApiTest extends TestCase { - public function testCredentials() + public function testCredentials(): void { $api = new Api; $api->setCredentials(new BasicAuth('api_username', 'api_password')); } - public function testShouldDoGetRequest() + public function testShouldDoGetRequest(): void { $endpoint = '/repositories/gentle/eof/issues/3'; $params = []; @@ -28,7 +28,7 @@ public function testShouldDoGetRequest() $this->assertSame('GET', $request->getMethod()); } - public function testShouldDoPostRequest() + public function testShouldDoPostRequest(): void { $endpoint = '/repositories/gentle/eof/issues/3'; $params = ['key' => 'value']; @@ -44,7 +44,7 @@ public function testShouldDoPostRequest() $this->assertSame(http_build_query($params), $request->getBody()->getContents()); } - public function testShouldDoPutRequest() + public function testShouldDoPutRequest(): void { $endpoint = '/repositories/gentle/eof/issues/3'; $params = ['key' => 'value']; @@ -60,7 +60,7 @@ public function testShouldDoPutRequest() $this->assertSame(http_build_query($params), $request->getBody()->getContents()); } - public function testShouldDoDeleteRequest() + public function testShouldDoDeleteRequest(): void { $endpoint = '/repositories/gentle/eof/issues/3'; $params = []; @@ -76,7 +76,7 @@ public function testShouldDoDeleteRequest() $this->assertSame('DELETE', $request->getMethod()); } - public function testFormat() + public function testFormat(): void { $this->expectException(\InvalidArgumentException::class); @@ -95,8 +95,9 @@ public function testFormat() /** * @dataProvider invalidChildNameProvider + * @param mixed $name */ - public function testSPFShouldFailWithInvalidClassName($name) + public function testSPFShouldFailWithInvalidClassName($name): void { $this->expectException(\InvalidArgumentException::class); @@ -104,7 +105,7 @@ public function testSPFShouldFailWithInvalidClassName($name) $bitbucket->api($name); } - public function testDifferentHttpClientInstanceOnCloning() + public function testDifferentHttpClientInstanceOnCloning(): void { $repo1 = new \Bitbucket\API\Repositories(); $repo2 = clone $repo1; @@ -115,10 +116,14 @@ public function testDifferentHttpClientInstanceOnCloning() $this->assertNotSame($repo1, $repo2); } - public function invalidChildNameProvider() + public function invalidChildNameProvider(): array { return [ - [[]], [new \stdClass()], [21], ['32.4'], ['invalid'] + [[]], + [new \stdClass()], + [21], + ['32.4'], + ['invalid'], ]; } } diff --git a/test/Bitbucket/Tests/API/GroupPrivilegesTest.php b/test/Bitbucket/Tests/API/GroupPrivilegesTest.php index 1f07e3a..fe31b58 100644 --- a/test/Bitbucket/Tests/API/GroupPrivilegesTest.php +++ b/test/Bitbucket/Tests/API/GroupPrivilegesTest.php @@ -15,7 +15,7 @@ protected function setUp(): void $this->groupPrivileges = $this->getApiMock(GroupPrivileges::class); } - public function testGetGroupsPrivilegesSuccess() + public function testGetGroupsPrivilegesSuccess(): void { $endpoint = '/1.0/group-privileges/gentle/'; @@ -24,7 +24,7 @@ public function testGetGroupsPrivilegesSuccess() $this->assertRequest('GET', $endpoint, '', 'format=json'); } - public function testGetRepositoryPrivilegesSuccess() + public function testGetRepositoryPrivilegesSuccess(): void { $endpoint = '/1.0/group-privileges/gentle/dummy-repo'; @@ -33,7 +33,7 @@ public function testGetRepositoryPrivilegesSuccess() $this->assertRequest('GET', $endpoint, '', 'format=json'); } - public function testGetGroupPrivilegesSuccess() + public function testGetGroupPrivilegesSuccess(): void { $endpoint = '/1.0/group-privileges/gentle/dummy-repo/owner/testers'; @@ -42,7 +42,7 @@ public function testGetGroupPrivilegesSuccess() $this->assertRequest('GET', $endpoint, '', 'format=json'); } - public function testGetRepositoriesPrivilegeGroupSuccess() + public function testGetRepositoriesPrivilegeGroupSuccess(): void { $endpoint = '/1.0/group-privileges/gentle/owner/testers'; @@ -51,14 +51,14 @@ public function testGetRepositoriesPrivilegeGroupSuccess() $this->assertRequest('GET', $endpoint, '', 'format=json'); } - public function testGrantGroupPrivilegesInvalidPrivilege() + public function testGrantGroupPrivilegesInvalidPrivilege(): void { $this->expectException(\InvalidArgumentException::class); $this->groupPrivileges->grant('gentle', 'repo', 'owner', 'sys-admins', 'invalid'); } - public function testGrantGroupPrivilegesSuccess() + public function testGrantGroupPrivilegesSuccess(): void { $endpoint = '/1.0/group-privileges/gentle/repo/owner/sys-admins'; $params = 'read'; @@ -68,7 +68,7 @@ public function testGrantGroupPrivilegesSuccess() $this->assertRequest('PUT', $endpoint, $params, 'format=json'); } - public function testRemoveGroupPrivilegesFromRepositorySuccess() + public function testRemoveGroupPrivilegesFromRepositorySuccess(): void { $endpoint = '/1.0/group-privileges/gentle/repo/owner/sys-admins'; diff --git a/test/Bitbucket/Tests/API/Groups/MembersTest.php b/test/Bitbucket/Tests/API/Groups/MembersTest.php index 29e08b6..663c013 100644 --- a/test/Bitbucket/Tests/API/Groups/MembersTest.php +++ b/test/Bitbucket/Tests/API/Groups/MembersTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->members = $this->getApiMock(Members::class); } - public function testGetAllGroupMembers() + public function testGetAllGroupMembers(): void { $endpoint = '/1.0/groups/gentle/testers/members'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testGetAllGroupMembers() $this->assertResponse($expectedResult, $actual); } - public function testAddMemberToGroupSuccess() + public function testAddMemberToGroupSuccess(): void { $endpoint = '/1.0/groups/gentle/testers/members/steve'; @@ -36,7 +36,7 @@ public function testAddMemberToGroupSuccess() $this->assertRequest('PUT', $endpoint, '', 'format=json'); } - public function testDeleteMemberFromGroupSuccess() + public function testDeleteMemberFromGroupSuccess(): void { $endpoint = '/1.0/groups/gentle/testers/members/steve'; diff --git a/test/Bitbucket/Tests/API/GroupsTest.php b/test/Bitbucket/Tests/API/GroupsTest.php index 0b60a52..8e47021 100644 --- a/test/Bitbucket/Tests/API/GroupsTest.php +++ b/test/Bitbucket/Tests/API/GroupsTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->groups = $this->getApiMock(Groups::class); } - public function testGetAllGroups() + public function testGetAllGroups(): void { $endpoint = '/1.0/groups/gentle/'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testGetAllGroups() $this->assertRequest('GET', $endpoint, '', 'format=json'); } - public function testGetAllGroupsWithFilters() + public function testGetAllGroupsWithFilters(): void { $endpoint = '/1.0/groups'; $query = 'group=gentle%2Ftesters%26group%3Dgentle%2Fmaintainers&format=json'; @@ -39,7 +39,7 @@ public function testGetAllGroupsWithFilters() $this->assertResponse($expectedResult, $actual); } - public function testCreateGroupSuccess() + public function testCreateGroupSuccess(): void { $endpoint = '/1.0/groups/gentle/'; $params = http_build_query([ @@ -51,7 +51,7 @@ public function testCreateGroupSuccess() $this->assertRequest('POST', $endpoint, $params, 'format=json'); } - public function testUpdateGroupSuccess() + public function testUpdateGroupSuccess(): void { $endpoint = '/1.0/groups/gentle/dummy/'; $params = [ @@ -64,7 +64,7 @@ public function testUpdateGroupSuccess() $this->assertRequest('PUT', $endpoint, http_build_query($params), 'format=json'); } - public function testDeleteGroupSuccess() + public function testDeleteGroupSuccess(): void { $endpoint = '/1.0/groups/gentle/dummy/'; @@ -73,7 +73,7 @@ public function testDeleteGroupSuccess() $this->assertRequest('DELETE', $endpoint, '', 'format=json'); } - public function testGetMembers() + public function testGetMembers(): void { $this->assertInstanceOf(Members::class, $this->groups->members()); } diff --git a/test/Bitbucket/Tests/API/Http/ClientTest.php b/test/Bitbucket/Tests/API/Http/ClientTest.php index cbe43d6..a3a2af5 100644 --- a/test/Bitbucket/Tests/API/Http/ClientTest.php +++ b/test/Bitbucket/Tests/API/Http/ClientTest.php @@ -20,19 +20,19 @@ public function setUp(): void $this->client = new Client(array(), $this->getHttpPluginClientBuilder()); } - public function testGetSelfInstance() + public function testGetSelfInstance(): void { $this->assertInstanceOf(HttpMethodsClient::class, $this->client->getClient()); } - public function testSetResponseFormatInvalid() + public function testSetResponseFormatInvalid(): void { $this->expectException(\InvalidArgumentException::class); $this->client->setResponseFormat('invalid'); } - public function testResponseFormatSuccess() + public function testResponseFormatSuccess(): void { $this->client->setResponseFormat('xml'); $this->assertEquals('xml', $this->client->getResponseFormat()); @@ -40,16 +40,17 @@ public function testResponseFormatSuccess() /** * @dataProvider invalidApiVersionsProvider + * @param int|string $version * @ticket 57 */ - public function testSetApiVersionInvalid($version) + public function testSetApiVersionInvalid($version): void { $this->expectException(\InvalidArgumentException::class); $this->client->setApiVersion($version); } - public function testApiVersionSuccess() + public function testApiVersionSuccess(): void { $this->client->setApiVersion('2.0'); $this->assertEquals('2.0', $this->client->getApiVersion()); @@ -60,13 +61,13 @@ public function testApiVersionSuccess() /** * @dataProvider apiBaseUrlProvider */ - public function testGetApiBaseUrl($apiVersion, $expected) + public function testGetApiBaseUrl(string $apiVersion, string $expected): void { $this->client->setApiVersion($apiVersion); $this->assertEquals($expected, $this->client->getApiBaseUrl()); } - public function apiBaseUrlProvider() + public function apiBaseUrlProvider(): array { return [ ['1.0', 'https://api.bitbucket.org/1.0'], @@ -74,7 +75,7 @@ public function apiBaseUrlProvider() ]; } - public function testShouldDoGetRequestAndReturnResponseInstance() + public function testShouldDoGetRequestAndReturnResponseInstance(): void { $endpoint = '/repositories/gentle/eof/issues/3'; $params = ['format' => 'json']; @@ -93,7 +94,7 @@ public function testShouldDoGetRequestAndReturnResponseInstance() $this->assertInstanceOf(ResponseInterface::class, $client->getLastResponse()); } - public function testShouldDoPostRequestWithContentAndReturnResponseInstance() + public function testShouldDoPostRequestWithContentAndReturnResponseInstance(): void { $endpoint = '/repositories/gentle/eof/issues/3'; $params = ['1' => '2']; @@ -115,7 +116,7 @@ public function testShouldDoPostRequestWithContentAndReturnResponseInstance() /** * @ticket 74 */ - public function testShouldDoPostRequestWithJsonContentAndReturnResponseInstance() + public function testShouldDoPostRequestWithJsonContentAndReturnResponseInstance(): void { $endpoint = '/repositories/gentle/eof/pullrequests'; $params = json_encode(['1' => '2', 'name' => 'john']); @@ -133,7 +134,7 @@ public function testShouldDoPostRequestWithJsonContentAndReturnResponseInstance( ], $client->getLastRequest()->getHeaders()); } - public function testShouldDoPutRequestAndReturnResponseInstance() + public function testShouldDoPutRequestAndReturnResponseInstance(): void { $endpoint = '/repositories/gentle/eof/issues/3'; $params = ['1' => '2']; @@ -145,7 +146,7 @@ public function testShouldDoPutRequestAndReturnResponseInstance() $this->assertInstanceOf(ResponseInterface::class, $response); } - public function testShouldDoDeleteRequestAndReturnResponseInstance() + public function testShouldDoDeleteRequestAndReturnResponseInstance(): void { $endpoint = '/repositories/gentle/eof/issues/3'; $params = ['1' => '2']; @@ -157,7 +158,7 @@ public function testShouldDoDeleteRequestAndReturnResponseInstance() $this->assertInstanceOf(ResponseInterface::class, $response); } - public function testShouldDoPatchRequestAndReturnResponseInstance() + public function testShouldDoPatchRequestAndReturnResponseInstance(): void { $endpoint = '/repositories/gentle/eof/issues/3'; $params = ['1' => '2']; @@ -169,7 +170,7 @@ public function testShouldDoPatchRequestAndReturnResponseInstance() $this->assertInstanceOf(ResponseInterface::class, $response); } - public function testClientIsKeptWhenInvokingChildFactory() + public function testClientIsKeptWhenInvokingChildFactory(): void { $options = [ 'base_url' => 'https://localhost' @@ -184,13 +185,13 @@ public function testClientIsKeptWhenInvokingChildFactory() /** * @dataProvider currentApiVersionProvider */ - public function testCurrentApiVersion($currentApiVersion, $apiVersion, $expected) + public function testCurrentApiVersion(string $currentApiVersion, string $apiVersion, bool $expected): void { $this->client->setApiVersion($currentApiVersion); $this->assertSame($expected, $this->client->isApiVersion($apiVersion)); } - public function currentApiVersionProvider() + public function currentApiVersionProvider(): array { return [ ['1.0', '1.0', true], @@ -204,7 +205,7 @@ public function currentApiVersionProvider() /** * @ticket 64 */ - public function testIncludeFormatParamOnlyInV1() + public function testIncludeFormatParamOnlyInV1(): void { $endpoint = sprintf( '/repositories/gentlero/bitbucket-api/src/%s/%s', @@ -227,7 +228,7 @@ public function testIncludeFormatParamOnlyInV1() $this->assertFalse(strpos($parts['query'], 'format')); } - public function invalidApiVersionsProvider() + public function invalidApiVersionsProvider(): array { return [ ['3.1'], ['1,2'], ['1,0'], ['2.1'], ['4'], [2], ['string'], [2.0] diff --git a/test/Bitbucket/Tests/API/Http/Plugin/ApiOneCollectionPluginTest.php b/test/Bitbucket/Tests/API/Http/Plugin/ApiOneCollectionPluginTest.php index 689cc7c..0366ee7 100644 --- a/test/Bitbucket/Tests/API/Http/Plugin/ApiOneCollectionPluginTest.php +++ b/test/Bitbucket/Tests/API/Http/Plugin/ApiOneCollectionPluginTest.php @@ -14,7 +14,7 @@ */ class ApiOneCollectionPluginTest extends Tests\TestCase { - public function testMetadataExistsForApiV1() + public function testMetadataExistsForApiV1(): void { $content = [ 'count' => 5, @@ -49,7 +49,7 @@ public function testMetadataExistsForApiV1() $this->assertEquals('http://localhost/1.0/repositories/team/repo/issues?limit=2&start=0', $body['previous']); } - public function testNonExistentPageReturnsLastPage() + public function testNonExistentPageReturnsLastPage(): void { $content = [ 'count' => 5, @@ -82,7 +82,7 @@ public function testNonExistentPageReturnsLastPage() $this->assertEquals('http://localhost/1.0/repositories/team/repo/issues?limit=2&start=4', $body['previous']); } - public function testInvalidJsonResponseShouldResultInANullBodyContent() + public function testInvalidJsonResponseShouldResultInANullBodyContent(): void { $plugin = new ApiOneCollectionPlugin(); $request = new Request('GET', 'http://localhost/1.0/repositories/team/repo/issues?limit=2&start=2'); @@ -100,7 +100,7 @@ public function testInvalidJsonResponseShouldResultInANullBodyContent() $this->assertNull($body); } - public function testResponseWithoutCollection() + public function testResponseWithoutCollection(): void { $content = [ 'issues' => [ diff --git a/test/Bitbucket/Tests/API/Http/Plugin/NormalizeArrayPluginTest.php b/test/Bitbucket/Tests/API/Http/Plugin/NormalizeArrayPluginTest.php index ec9449c..1adf0b8 100644 --- a/test/Bitbucket/Tests/API/Http/Plugin/NormalizeArrayPluginTest.php +++ b/test/Bitbucket/Tests/API/Http/Plugin/NormalizeArrayPluginTest.php @@ -13,7 +13,7 @@ */ class NormalizeArrayPluginTest extends Tests\TestCase { - public function testPHPArrayToApiArrayConversionForQuery() + public function testPHPArrayToApiArrayConversionForQuery(): void { $plugin = new NormalizeArrayPlugin(); $query = http_build_query(['state' => ['OPEN', 'MERGED']]); diff --git a/test/Bitbucket/Tests/API/Http/Response/PagerTest.php b/test/Bitbucket/Tests/API/Http/Response/PagerTest.php index 6fcdcef..22bdc18 100644 --- a/test/Bitbucket/Tests/API/Http/Response/PagerTest.php +++ b/test/Bitbucket/Tests/API/Http/Response/PagerTest.php @@ -4,6 +4,7 @@ use Bitbucket\API\Http\Response\Pager; use Bitbucket\Tests\API\TestCase; +use GuzzleHttp\Psr7\Response; use Psr\Http\Message\ResponseInterface; /** @@ -11,7 +12,7 @@ */ class PagerTest extends TestCase { - public function testFetchNextSuccess() + public function testFetchNextSuccess(): void { $response = $this->fakeResponse([ 'values' => [], @@ -24,7 +25,7 @@ public function testFetchNextSuccess() $this->assertInstanceOf(ResponseInterface::class, $page->fetchNext()); } - public function testFetchNextFail() + public function testFetchNextFail(): void { $response = $this->fakeResponse([ 'values' => [], @@ -36,7 +37,7 @@ public function testFetchNextFail() $this->assertNull($page->fetchNext()); } - public function testFetchPreviousSuccess() + public function testFetchPreviousSuccess(): void { $response = $this->fakeResponse([ 'values' => [], @@ -49,7 +50,7 @@ public function testFetchPreviousSuccess() $this->assertInstanceOf(ResponseInterface::class, $page->fetchPrevious()); } - public function testFetchPreviousFail() + public function testFetchPreviousFail(): void { $response = $this->fakeResponse([ 'values' => [], @@ -61,7 +62,7 @@ public function testFetchPreviousFail() $this->assertNull($page->fetchPrevious()); } - public function testFetchAllSuccess() + public function testFetchAllSuccess(): void { $response = $this->fakeResponse([ 'values' => ['dummy_1' => 'value_1'], @@ -88,7 +89,7 @@ public function testFetchAllSuccess() $this->assertEquals($expected, json_decode($response->getBody()->getContents(), true)); } - public function testFetchAllWithEmptyResponseShouldReturnEmptyValuesArray() + public function testFetchAllWithEmptyResponseShouldReturnEmptyValuesArray(): void { $response = $this->fakeResponse(['values' => []]); $this->fakeResponse(['values' => []]); @@ -101,10 +102,11 @@ public function testFetchAllWithEmptyResponseShouldReturnEmptyValuesArray() $this->assertEquals(['values' => []], json_decode($response->getBody()->getContents(), true)); } - public function testFetchAllWithInvalidJsonShouldReturnEmptyValuesArray() + public function testFetchAllWithInvalidJsonShouldReturnEmptyValuesArray(): void { $expected = ['values' => []]; - $response = $this->fakeResponse('{"something": "yes"', 200, false); + $response = new Response(200, [], '{"something": "yes"'); + $this->getMockHttpClient()->addResponse($response); $page = new Pager($this->getHttpPluginClientBuilder(), $response); $response = $page->fetchAll(); @@ -113,7 +115,7 @@ public function testFetchAllWithInvalidJsonShouldReturnEmptyValuesArray() $this->assertEquals($expected, json_decode($response->getBody()->getContents(), true)); } - public function testFetchAllWithUnauthorizedHeaderShouldFail() + public function testFetchAllWithUnauthorizedHeaderShouldFail(): void { $this->expectException(\UnexpectedValueException::class); @@ -122,12 +124,12 @@ public function testFetchAllWithUnauthorizedHeaderShouldFail() new Pager($this->getHttpPluginClientBuilder(), $response); } - public function testGetCurrentResponseSuccess() + public function testGetCurrentResponseSuccess(): void { - $response = $this->fakeResponse(json_encode([ + $response = $this->fakeResponse([ 'values' => [], 'previous' => 'https://example.com/something?page=2' - ])); + ]); $page = new Pager($this->getHttpPluginClientBuilder(), $response); $response = $page->getCurrent(); diff --git a/test/Bitbucket/Tests/API/InvitationsTest.php b/test/Bitbucket/Tests/API/InvitationsTest.php index 24272e4..ed888a6 100644 --- a/test/Bitbucket/Tests/API/InvitationsTest.php +++ b/test/Bitbucket/Tests/API/InvitationsTest.php @@ -15,7 +15,7 @@ protected function setUp(): void $this->invitations = $this->getApiMock(Invitations::class); } - public function testSendInvitationSuccess() + public function testSendInvitationSuccess(): void { $endpoint = '/1.0/invitations/gentle/eof'; $params = http_build_query(['permission' => 'read', 'email' => 'john_doe@example.com']); diff --git a/test/Bitbucket/Tests/API/Repositories/BranchRestrictionsTest.php b/test/Bitbucket/Tests/API/Repositories/BranchRestrictionsTest.php index 910ddc6..bf8dc26 100644 --- a/test/Bitbucket/Tests/API/Repositories/BranchRestrictionsTest.php +++ b/test/Bitbucket/Tests/API/Repositories/BranchRestrictionsTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->branchRestrictions = $this->getApiMock(BranchRestrictions::class); } - public function testGetAllRestrictions() + public function testGetAllRestrictions(): void { $endpoint = '/2.0/repositories/gentle/eof/branch-restrictions'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testGetAllRestrictions() $this->assertResponse($expectedResult, $actual); } - public function testAddRestrictionType() + public function testAddRestrictionType(): void { $endpoint = '/2.0/repositories/gentle/eof/branch-restrictions'; $params = [ @@ -40,7 +40,7 @@ public function testAddRestrictionType() $this->assertRequest('POST', $endpoint, json_encode($params)); } - public function testCreateRestrictionFromArray() + public function testCreateRestrictionFromArray(): void { $endpoint = '/2.0/repositories/gentle/eof/branch-restrictions'; $params = [ @@ -52,7 +52,7 @@ public function testCreateRestrictionFromArray() $this->assertRequest('POST', $endpoint, json_encode($params)); } - public function testCreateRestrictionFromJSON() + public function testCreateRestrictionFromJSON(): void { $endpoint = '/2.0/repositories/gentle/eof/branch-restrictions'; $params = json_encode([ @@ -66,15 +66,16 @@ public function testCreateRestrictionFromJSON() /** * @dataProvider restrictionsInvalidParamsProvider + * @param int|string $params */ - public function testCreateRestrictionWithInvalidParams($params) + public function testCreateRestrictionWithInvalidParams($params): void { $this->expectException(\InvalidArgumentException::class); $this->branchRestrictions->create('gentle', 'eof', $params); } - public function restrictionsInvalidParamsProvider() + public function restrictionsInvalidParamsProvider(): array { return [ [''], @@ -83,7 +84,7 @@ public function restrictionsInvalidParamsProvider() ]; } - public function testCreateRestrictionFromArrayShouldFailWithInvalidRestrictionKind() + public function testCreateRestrictionFromArrayShouldFailWithInvalidRestrictionKind(): void { $this->expectException(\InvalidArgumentException::class); @@ -94,7 +95,7 @@ public function testCreateRestrictionFromArrayShouldFailWithInvalidRestrictionKi $this->branchRestrictions->create('gentle', 'eof', $params); } - public function testCreateRestrictionFromJSONShouldFailWithInvalidRestrictionKind() + public function testCreateRestrictionFromJSONShouldFailWithInvalidRestrictionKind(): void { $this->expectException(\InvalidArgumentException::class); @@ -105,7 +106,7 @@ public function testCreateRestrictionFromJSONShouldFailWithInvalidRestrictionKin $this->branchRestrictions->create('gentle', 'eof', $params); } - public function testGetSpecificRestriction() + public function testGetSpecificRestriction(): void { $endpoint = '/2.0/repositories/gentle/eof/branch-restrictions/1'; $expectedResult = $this->fakeResponse(['dummy']); @@ -116,7 +117,7 @@ public function testGetSpecificRestriction() $this->assertResponse($expectedResult, $actual); } - public function testUpdateRestrictionFromArray() + public function testUpdateRestrictionFromArray(): void { $endpoint = '/2.0/repositories/gentle/eof/branch-restrictions/1'; $params = [ @@ -131,7 +132,7 @@ public function testUpdateRestrictionFromArray() $this->assertRequest('PUT', $endpoint, json_encode($params)); } - public function testUpdateRestrictionFromJSON() + public function testUpdateRestrictionFromJSON(): void { $endpoint = '/2.0/repositories/gentle/eof/branch-restrictions/1'; $params = json_encode([ @@ -148,15 +149,16 @@ public function testUpdateRestrictionFromJSON() /** * @dataProvider restrictionsInvalidParamsProvider + * @param int|string $params */ - public function testUpdateRestrictionWithInvalidParams($params) + public function testUpdateRestrictionWithInvalidParams($params): void { $this->expectException(\InvalidArgumentException::class); $this->branchRestrictions->update('gentle', 'eof', 1, $params); } - public function testCreateRestrictionShouldFailIfKindIsSpecified() + public function testCreateRestrictionShouldFailIfKindIsSpecified(): void { $this->expectException(\InvalidArgumentException::class); @@ -167,7 +169,7 @@ public function testCreateRestrictionShouldFailIfKindIsSpecified() $this->branchRestrictions->update('gentle', 'eof', 1, $params); } - public function testDeleteRestriction() + public function testDeleteRestriction(): void { $endpoint = '/2.0/repositories/gentle/eof/branch-restrictions/1'; diff --git a/test/Bitbucket/Tests/API/Repositories/Commits/BuildStatusesTest.php b/test/Bitbucket/Tests/API/Repositories/Commits/BuildStatusesTest.php index ddc16cb..d74258e 100644 --- a/test/Bitbucket/Tests/API/Repositories/Commits/BuildStatusesTest.php +++ b/test/Bitbucket/Tests/API/Repositories/Commits/BuildStatusesTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->buildStatuses = $this->getApiMock(BuildStatuses::class); } - public function testGet() + public function testGet(): void { $endpoint = '/2.0/repositories/gentle/eof/commit/SHA1/statuses/build/KEY'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testGet() $this->assertResponse($expectedResult, $actual); } - public function testCreate() + public function testCreate(): void { $endpoint = '/2.0/repositories/gentle/eof/commit/SHA1/statuses/build'; $params = [ @@ -39,7 +39,7 @@ public function testCreate() $this->assertRequest('POST', $endpoint, json_encode($params)); } - public function testUpdate() + public function testUpdate(): void { $endpoint = '/2.0/repositories/gentle/eof/commit/SHA1/statuses/build/KEY'; $params = [ diff --git a/test/Bitbucket/Tests/API/Repositories/Commits/CommentsTest.php b/test/Bitbucket/Tests/API/Repositories/Commits/CommentsTest.php index 2d93131..8ce811a 100644 --- a/test/Bitbucket/Tests/API/Repositories/Commits/CommentsTest.php +++ b/test/Bitbucket/Tests/API/Repositories/Commits/CommentsTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->comments = $this->getApiMock(Comments::class); } - public function testGetAllComments() + public function testGetAllComments(): void { $endpoint = '/2.0/repositories/gentle/eof/commit/SHA1/comments'; $expectedResult = $this->fakeResponse(array('dummy')); @@ -27,7 +27,7 @@ public function testGetAllComments() $this->assertResponse($expectedResult, $actual); } - public function testGetSingleComment() + public function testGetSingleComment(): void { $endpoint = '/2.0/repositories/gentle/eof/commit/SHA1/comments/1'; $expectedResult = $this->fakeResponse(array('dummy')); diff --git a/test/Bitbucket/Tests/API/Repositories/CommitsTest.php b/test/Bitbucket/Tests/API/Repositories/CommitsTest.php index e1c460e..0052ce3 100644 --- a/test/Bitbucket/Tests/API/Repositories/CommitsTest.php +++ b/test/Bitbucket/Tests/API/Repositories/CommitsTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->commits = $this->getApiMock(Commits::class); } - public function testGetAllRepositoryCommits() + public function testGetAllRepositoryCommits(): void { $endpoint = '/2.0/repositories/gentle/eof/commits'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testGetAllRepositoryCommits() $this->assertResponse($expectedResult, $actual); } - public function testGetAllRepositoryCommitsFromSpecificBranch() + public function testGetAllRepositoryCommitsFromSpecificBranch(): void { $endpoint = '/2.0/repositories/gentle/eof/commits/master'; $expectedResult = $this->fakeResponse(['dummy', 'branch' => 'master']); @@ -38,7 +38,7 @@ public function testGetAllRepositoryCommitsFromSpecificBranch() $this->assertResponse($expectedResult, $actual); } - public function testGetSingleCommitInfo() + public function testGetSingleCommitInfo(): void { $endpoint = '/2.0/repositories/gentle/eof/commit/SHA'; $expectedResult = $this->fakeResponse(['dummy']); @@ -49,7 +49,7 @@ public function testGetSingleCommitInfo() $this->assertResponse($expectedResult, $actual); } - public function testApproveACommit() + public function testApproveACommit(): void { $endpoint = '/2.0/repositories/gentle/eof/commit/SHA1/approve'; @@ -58,7 +58,7 @@ public function testApproveACommit() $this->assertRequest('POST', $endpoint); } - public function testDeleteCommitApproval() + public function testDeleteCommitApproval(): void { $endpoint = '/2.0/repositories/gentle/eof/commit/SHA1/approve'; @@ -67,7 +67,7 @@ public function testDeleteCommitApproval() $this->assertRequest('DELETE', $endpoint); } - public function testGetMembers() + public function testGetMembers(): void { $this->assertInstanceOf(Commits\Comments::class, $this->commits->comments()); } diff --git a/test/Bitbucket/Tests/API/Repositories/DeploykeysTest.php b/test/Bitbucket/Tests/API/Repositories/DeploykeysTest.php index 1b50443..4289bde 100644 --- a/test/Bitbucket/Tests/API/Repositories/DeploykeysTest.php +++ b/test/Bitbucket/Tests/API/Repositories/DeploykeysTest.php @@ -16,10 +16,10 @@ protected function setUp(): void $this->deploykeys = $this->getApiMock(Deploykeys::class); } - public function testGetAllKeys() + public function testGetAllKeys(): void { $endpoint = '/2.0/repositories/gentle/eof/deploy-keys'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->deploykeys->all('gentle', 'eof'); @@ -27,10 +27,10 @@ public function testGetAllKeys() $this->assertResponse($expectedResult, $actual); } - public function testGetSingleKey() + public function testGetSingleKey(): void { $endpoint = '/2.0/repositories/gentle/eof/deploy-keys/3'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->deploykeys->get('gentle', 'eof', '3'); @@ -38,7 +38,7 @@ public function testGetSingleKey() $this->assertResponse($expectedResult, $actual); } - public function testAddNewKeySuccess() + public function testAddNewKeySuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/deploy-keys'; $params = [ @@ -51,7 +51,7 @@ public function testAddNewKeySuccess() $this->assertRequest('POST', $endpoint, http_build_query($params)); } - public function testUpdateKeySuccess() + public function testUpdateKeySuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/deploy-keys/3'; $params = ['label' => 'test key']; @@ -61,7 +61,7 @@ public function testUpdateKeySuccess() $this->assertRequest('PUT', $endpoint, http_build_query($params)); } - public function testDeleteKeySuccess() + public function testDeleteKeySuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/deploy-keys/3'; diff --git a/test/Bitbucket/Tests/API/Repositories/HooksTest.php b/test/Bitbucket/Tests/API/Repositories/HooksTest.php index 6557d77..84ab46b 100644 --- a/test/Bitbucket/Tests/API/Repositories/HooksTest.php +++ b/test/Bitbucket/Tests/API/Repositories/HooksTest.php @@ -26,7 +26,7 @@ protected function setUp(): void $this->hooks = $this->getApiMock(Hooks::class); } - public function invalidCreateProvider() + public function invalidCreateProvider(): array { return [ [[ @@ -66,14 +66,14 @@ public function invalidCreateProvider() /** * @dataProvider invalidCreateProvider */ - public function testInvalidCreate(array $check) + public function testInvalidCreate(array $check): void { $this->expectException(\InvalidArgumentException::class); $this->hooks->create('gentle', 'my-repo', $check); } - public function testCreateSuccess() + public function testCreateSuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/hooks'; $params = [ @@ -94,7 +94,7 @@ public function testCreateSuccess() /** * @ticket 72 */ - public function testCreateIssue72() + public function testCreateIssue72(): void { $endpoint = '/2.0/repositories/gentle/eof/hooks'; $params = [ @@ -113,7 +113,7 @@ public function testCreateIssue72() $this->assertInstanceOf(ResponseInterface::class, $response); } - public function testCreateSuccessWithExtraParameters() + public function testCreateSuccessWithExtraParameters(): void { $endpoint = '/2.0/repositories/gentle/eof/hooks'; $params = [ @@ -132,7 +132,7 @@ public function testCreateSuccessWithExtraParameters() $this->assertRequest('POST', $endpoint, json_encode($params)); } - public function testUpdateSuccess() + public function testUpdateSuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/hooks/30b60aee-9cdf-407d-901c-2de106ee0c9d'; $params = [ @@ -153,14 +153,14 @@ public function testUpdateSuccess() /** * @dataProvider invalidCreateProvider */ - public function testInvalidUpdate(array $check) + public function testInvalidUpdate(array $check): void { $this->expectException(\InvalidArgumentException::class); $this->hooks->update('gentle', 'eof', '30b60aee-9cdf-407d-901c-2de106ee0c9d', $check); } - public function testGetAllHooks() + public function testGetAllHooks(): void { $endpoint = '/2.0/repositories/gentle/eof/hooks'; $expectedResult = $this->fakeResponse(['dummy']); @@ -171,7 +171,7 @@ public function testGetAllHooks() $this->assertResponse($expectedResult, $actual); } - public function testGetSingleHook() + public function testGetSingleHook(): void { $endpoint = '/2.0/repositories/gentle/eof/hooks/30b60aee-9cdf-407d-901c-2de106ee0c9d'; $expectedResult = $this->fakeResponse(['dummy']); @@ -182,7 +182,7 @@ public function testGetSingleHook() $this->assertResponse($expectedResult, $actual); } - public function testDeleteSingleHook() + public function testDeleteSingleHook(): void { $endpoint = '/2.0/repositories/gentle/eof/hooks/30b60aee-9cdf-407d-901c-2de106ee0c9d'; diff --git a/test/Bitbucket/Tests/API/Repositories/Issues/CommentsTest.php b/test/Bitbucket/Tests/API/Repositories/Issues/CommentsTest.php index f64a3e5..375e465 100644 --- a/test/Bitbucket/Tests/API/Repositories/Issues/CommentsTest.php +++ b/test/Bitbucket/Tests/API/Repositories/Issues/CommentsTest.php @@ -16,10 +16,10 @@ protected function setUp(): void $this->comments = $this->getApiMock(Comments::class); } - public function testGetSingleCommentSuccess() + public function testGetSingleCommentSuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/issues/3/comments/2967835'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->comments->get('gentle', 'eof', 3, 2967835); @@ -27,10 +27,10 @@ public function testGetSingleCommentSuccess() $this->assertResponse($expectedResult, $actual); } - public function testGetAllCommentsSuccess() + public function testGetAllCommentsSuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/issues/3/comments'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->comments->all('gentle', 'eof', 3); @@ -38,7 +38,7 @@ public function testGetAllCommentsSuccess() $this->assertResponse($expectedResult, $actual); } - public function testCreateCommentSuccess() + public function testCreateCommentSuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/issues/2/comments'; $params = ['content' => ['raw' => 'dummy']]; @@ -48,7 +48,7 @@ public function testCreateCommentSuccess() $this->assertRequest('POST', $endpoint, json_encode($params)); } - public function testUpdateCommentSuccess() + public function testUpdateCommentSuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/issues/2/comments/3'; $params = ['content' => ['raw' => 'dummy']]; diff --git a/test/Bitbucket/Tests/API/Repositories/IssuesTest.php b/test/Bitbucket/Tests/API/Repositories/IssuesTest.php index 465abdd..52f8bcc 100644 --- a/test/Bitbucket/Tests/API/Repositories/IssuesTest.php +++ b/test/Bitbucket/Tests/API/Repositories/IssuesTest.php @@ -16,10 +16,10 @@ protected function setUp(): void $this->issues = $this->getApiMock(Issues::class); } - public function testGetIssuesWithAdditionalParams() + public function testGetIssuesWithAdditionalParams(): void { $endpoint = '/2.0/repositories/gentle/eof/issues'; - $expectedResult = $this->fakeResponse(file_get_contents(__DIR__.'/../data/issue/multiple.json')); + $expectedResult = $this->fakeResponse(json_decode(file_get_contents(__DIR__.'/../data/issue/multiple.json'), true)); $params = [ 'format' => 'json', 'limit' => 5, @@ -32,10 +32,10 @@ public function testGetIssuesWithAdditionalParams() $this->assertResponse($expectedResult, $actual); } - public function testGet() + public function testGet(): void { $endpoint = '/2.0/repositories/gentle/eof/issues/3'; - $expectedResult = $this->fakeResponse(file_get_contents(__DIR__.'/../data/issue/single.json')); + $expectedResult = $this->fakeResponse(json_decode(file_get_contents(__DIR__.'/../data/issue/single.json'), true)); $actual = $this->issues->get('gentle', 'eof', 3); @@ -43,7 +43,7 @@ public function testGet() $this->assertResponse($expectedResult, $actual); } - public function testCreateIssue() + public function testCreateIssue(): void { $endpoint = '/2.0/repositories/gentle/eof/issues'; $params = [ @@ -56,7 +56,7 @@ public function testCreateIssue() $this->assertRequest('POST', $endpoint, json_encode($params)); } - public function testShouldNotCreateIssueWithoutTitle() + public function testShouldNotCreateIssueWithoutTitle(): void { $this->expectException(\InvalidArgumentException::class); @@ -67,7 +67,7 @@ public function testShouldNotCreateIssueWithoutTitle() $this->issues->create('gentle', 'eof', $params); } - public function testShouldNotCreateIssueWithoutContent() + public function testShouldNotCreateIssueWithoutContent(): void { $this->expectException(\InvalidArgumentException::class); @@ -78,7 +78,7 @@ public function testShouldNotCreateIssueWithoutContent() $this->issues->create('gentle', 'eof', $params); } - public function testUpdateIssue() + public function testUpdateIssue(): void { $endpoint = '/2.0/repositories/gentle/eof/issues/3'; $params = [ @@ -92,7 +92,7 @@ public function testUpdateIssue() } - public function testDeleteIssue() + public function testDeleteIssue(): void { $endpoint = '/2.0/repositories/gentle/eof/issues/2'; $expectedResult = $this->fakeResponse(['dummyOutput']); @@ -103,7 +103,7 @@ public function testDeleteIssue() $this->assertResponse($expectedResult, $actual); } - public function testGetComments() + public function testGetComments(): void { $this->assertInstanceOf(Issues\Comments::class, $this->issues->comments()); } diff --git a/test/Bitbucket/Tests/API/Repositories/MilestonesTest.php b/test/Bitbucket/Tests/API/Repositories/MilestonesTest.php index 72d5a33..b59eb1b 100644 --- a/test/Bitbucket/Tests/API/Repositories/MilestonesTest.php +++ b/test/Bitbucket/Tests/API/Repositories/MilestonesTest.php @@ -16,10 +16,10 @@ protected function setUp(): void $this->milestones = $this->getApiMock(Milestones::class); } - public function testGetAllMilestonesSuccess() + public function testGetAllMilestonesSuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/milestones'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->milestones->all('gentle', 'eof'); @@ -27,10 +27,10 @@ public function testGetAllMilestonesSuccess() $this->assertResponse($expectedResult, $actual); } - public function testGetSingleMilestoneSuccess() + public function testGetSingleMilestoneSuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/milestones/2'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->milestones->get('gentle', 'eof', 2); diff --git a/test/Bitbucket/Tests/API/Repositories/Pipelines/StepsTest.php b/test/Bitbucket/Tests/API/Repositories/Pipelines/StepsTest.php index 714fd18..f865312 100644 --- a/test/Bitbucket/Tests/API/Repositories/Pipelines/StepsTest.php +++ b/test/Bitbucket/Tests/API/Repositories/Pipelines/StepsTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->steps = $this->getApiMock(Steps::class); } - public function testGetAllSteps() + public function testGetAllSteps(): void { $endpoint = '/2.0/repositories/gentle/eof/pipelines/pipeline-uuid/steps/'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testGetAllSteps() $this->assertResponse($expectedResult, $actual); } - public function testGetSpecificPipelineStep() + public function testGetSpecificPipelineStep(): void { $endpoint = '/2.0/repositories/gentle/eof/pipelines/pipeline-uuid/steps/step-uuid'; $expectedResult = $this->fakeResponse(['dummy']); @@ -38,7 +38,7 @@ public function testGetSpecificPipelineStep() $this->assertResponse($expectedResult, $actual); } - public function testGetLogOfSpecificPipelineStep() + public function testGetLogOfSpecificPipelineStep(): void { $endpoint = '/2.0/repositories/gentle/eof/pipelines/pipeline-uuid/steps/step-uuid/log'; $expectedResult = $this->fakeResponse(['dummy']); diff --git a/test/Bitbucket/Tests/API/Repositories/PipelinesTest.php b/test/Bitbucket/Tests/API/Repositories/PipelinesTest.php index dbc455a..5950100 100644 --- a/test/Bitbucket/Tests/API/Repositories/PipelinesTest.php +++ b/test/Bitbucket/Tests/API/Repositories/PipelinesTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->pipelines = $this->getApiMock(Pipelines::class); } - public function testGetAllPipelines() + public function testGetAllPipelines(): void { $endpoint = '/2.0/repositories/gentle/eof/pipelines/'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testGetAllPipelines() $this->assertResponse($expectedResult, $actual); } - public function testCreatePipelinesFromArray() + public function testCreatePipelinesFromArray(): void { $endpoint = '/2.0/repositories/gentle/eof/pipelines/'; $params = [ @@ -43,7 +43,7 @@ public function testCreatePipelinesFromArray() $this->assertRequest('POST', $endpoint, json_encode($params)); } - public function testCreatePipelinesFromJson() + public function testCreatePipelinesFromJson(): void { $endpoint = '/2.0/repositories/gentle/eof/pipelines/'; $params = json_encode([ @@ -59,7 +59,7 @@ public function testCreatePipelinesFromJson() $this->assertRequest('POST', $endpoint, $params); } - public function testGetSpecificPipeline() + public function testGetSpecificPipeline(): void { $endpoint = '/2.0/repositories/gentle/eof/pipelines/uuid'; $expectedResult = $this->fakeResponse(['dummy']); @@ -70,7 +70,7 @@ public function testGetSpecificPipeline() $this->assertResponse($expectedResult, $actual); } - public function testStopSpecificPipeline() + public function testStopSpecificPipeline(): void { $endpoint = '/2.0/repositories/gentle/eof/pipelines/uuid/stopPipeline'; @@ -79,7 +79,7 @@ public function testStopSpecificPipeline() $this->assertRequest('POST', $endpoint); } - public function testGetSteps() + public function testGetSteps(): void { $this->assertInstanceOf(Pipelines\Steps::class, $this->pipelines->steps()); } diff --git a/test/Bitbucket/Tests/API/Repositories/PullRequests/CommentsTest.php b/test/Bitbucket/Tests/API/Repositories/PullRequests/CommentsTest.php index 7dc91b9..e23e9e9 100644 --- a/test/Bitbucket/Tests/API/Repositories/PullRequests/CommentsTest.php +++ b/test/Bitbucket/Tests/API/Repositories/PullRequests/CommentsTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->comments = $this->getApiMock(Comments::class); } - public function testGetAllComments() + public function testGetAllComments(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/3/comments'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testGetAllComments() $this->assertResponse($expectedResult, $actual); } - public function testGetSingleComment() + public function testGetSingleComment(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/3/comments/1'; $expectedResult = $this->fakeResponse(['dummy']); @@ -38,7 +38,7 @@ public function testGetSingleComment() $this->assertResponse($expectedResult, $actual); } - public function testCreateCommentSuccess() + public function testCreateCommentSuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/comments'; $expectedResult = $this->fakeResponse(['dummy']); @@ -49,7 +49,7 @@ public function testCreateCommentSuccess() $this->assertResponse($expectedResult, $actual); } - public function testUpdateCommentSuccess() + public function testUpdateCommentSuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/comments/3'; $expectedResult = $this->fakeResponse(['content' => 'dummy']); @@ -60,7 +60,7 @@ public function testUpdateCommentSuccess() $this->assertResponse($expectedResult, $actual); } - public function testDeleteCommentSuccess() + public function testDeleteCommentSuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/comments/2'; diff --git a/test/Bitbucket/Tests/API/Repositories/PullRequestsTest.php b/test/Bitbucket/Tests/API/Repositories/PullRequestsTest.php index 4e03a37..7bff928 100644 --- a/test/Bitbucket/Tests/API/Repositories/PullRequestsTest.php +++ b/test/Bitbucket/Tests/API/Repositories/PullRequestsTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->pullRequests = $this->getApiMock(PullRequests::class); } - public function testGetAllPullRequests() + public function testGetAllPullRequests(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testGetAllPullRequests() $this->assertResponse($expectedResult, $actual); } - public function testCreateNewPullRequestFromJSON() + public function testCreateNewPullRequestFromJSON(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests'; $params = json_encode([ @@ -52,7 +52,7 @@ public function testCreateNewPullRequestFromJSON() $this->assertRequest('POST', $endpoint, $params); } - public function testCreateNewPullRequestFromArray() + public function testCreateNewPullRequestFromArray(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests'; $params = [ @@ -79,15 +79,16 @@ public function testCreateNewPullRequestFromArray() /** * @dataProvider pullRequestWrongParamsTypeProvider + * @param string|int $params */ - public function testCreateNewPullRequestWithWrongParamsType($params) + public function testCreateNewPullRequestWithWrongParamsType($params): void { $this->expectException(\InvalidArgumentException::class); $this->pullRequests->create('gentle', 'eof', $params); } - public function pullRequestWrongParamsTypeProvider() + public function pullRequestWrongParamsTypeProvider(): array { return [ [''], @@ -96,7 +97,7 @@ public function pullRequestWrongParamsTypeProvider() ]; } - public function testUpdatePullRequestFromJSON() + public function testUpdatePullRequestFromJSON(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1'; $params = json_encode([ @@ -113,7 +114,7 @@ public function testUpdatePullRequestFromJSON() $this->assertRequest('PUT', $endpoint, $params); } - public function testUpdatePullRequestFromArray() + public function testUpdatePullRequestFromArray(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1'; $params = [ @@ -132,15 +133,16 @@ public function testUpdatePullRequestFromArray() /** * @dataProvider pullRequestWrongParamsTypeProvider + * @param string|int $params */ - public function testUpdatePullRequestWithWrongParamsType($params) + public function testUpdatePullRequestWithWrongParamsType($params): void { $this->expectException(\InvalidArgumentException::class); $this->pullRequests->update('gentle', 'eof', 1, $params); } - public function testGetSpecificPullRequest() + public function testGetSpecificPullRequest(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1'; $expectedResult = $this->fakeResponse(['dummy']); @@ -151,7 +153,7 @@ public function testGetSpecificPullRequest() $this->assertResponse($expectedResult, $actual); } - public function testGetCommitsForSpecificPullRequest() + public function testGetCommitsForSpecificPullRequest(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/commits'; $expectedResult = $this->fakeResponse(['dummy']); @@ -162,7 +164,7 @@ public function testGetCommitsForSpecificPullRequest() $this->assertResponse($expectedResult, $actual); } - public function testApproveAPullRequest() + public function testApproveAPullRequest(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/approve'; @@ -171,7 +173,7 @@ public function testApproveAPullRequest() $this->assertRequest('POST', $endpoint); } - public function testDeletePullRequestApproval() + public function testDeletePullRequestApproval(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/approve'; @@ -180,7 +182,7 @@ public function testDeletePullRequestApproval() $this->assertRequest('DELETE', $endpoint); } - public function testGetPullRequestDiff() + public function testGetPullRequestDiff(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/diff'; $expectedResult = $this->fakeResponse(['dummy']); @@ -191,7 +193,7 @@ public function testGetPullRequestDiff() $this->assertResponse($expectedResult, $actual); } - public function testGetPullRequestDiffstat() + public function testGetPullRequestDiffstat(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/diffstat'; $expectedResult = $this->fakeResponse(['dummy']); @@ -202,7 +204,7 @@ public function testGetPullRequestDiffstat() $this->assertResponse($expectedResult, $actual); } - public function testGetPullRequestActivity() + public function testGetPullRequestActivity(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/activity'; $expectedResult = $this->fakeResponse(['dummy']); @@ -213,7 +215,7 @@ public function testGetPullRequestActivity() $this->assertResponse($expectedResult, $actual); } - public function testGetRepositoryPullRequestActivity() + public function testGetRepositoryPullRequestActivity(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/activity'; $expectedResult = $this->fakeResponse(['dummy']); @@ -224,7 +226,7 @@ public function testGetRepositoryPullRequestActivity() $this->assertResponse($expectedResult, $actual); } - public function testAcceptAndMergeAPullRequest() + public function testAcceptAndMergeAPullRequest(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/merge'; $params = [ @@ -237,7 +239,7 @@ public function testAcceptAndMergeAPullRequest() $this->assertRequest('POST', $endpoint, json_encode($params)); } - public function testDeclineAPullRequest() + public function testDeclineAPullRequest(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/decline'; $params = [ @@ -252,7 +254,7 @@ public function testDeclineAPullRequest() /** * @ticket 43 */ - public function testDeclineAPullRequestWithoutAMessage() + public function testDeclineAPullRequestWithoutAMessage(): void { $endpoint = '/2.0/repositories/gentle/eof/pullrequests/1/decline'; $params = [ diff --git a/test/Bitbucket/Tests/API/Repositories/Refs/BranchesTest.php b/test/Bitbucket/Tests/API/Repositories/Refs/BranchesTest.php index 557398c..987569a 100644 --- a/test/Bitbucket/Tests/API/Repositories/Refs/BranchesTest.php +++ b/test/Bitbucket/Tests/API/Repositories/Refs/BranchesTest.php @@ -16,10 +16,10 @@ protected function setUp(): void $this->branches = $this->getApiMock(Branches::class); } - public function testAll() + public function testAll(): void { $endpoint = '/2.0/repositories/gentle/eof/refs/branches'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->branches->all('gentle', 'eof'); @@ -27,11 +27,11 @@ public function testAll() $this->assertResponse($expectedResult, $actual); } - public function testAllParams() + public function testAllParams(): void { $params = ['pagelen' => 36]; $endpoint = '/2.0/repositories/gentle/eof/refs/branches'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->branches->all('gentle', 'eof', $params); @@ -39,10 +39,10 @@ public function testAllParams() $this->assertResponse($expectedResult, $actual); } - public function testGet() + public function testGet(): void { $endpoint = '/2.0/repositories/gentle/eof/refs/branches/abranch'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->branches->get('gentle', 'eof', 'abranch'); @@ -50,10 +50,10 @@ public function testGet() $this->assertResponse($expectedResult, $actual); } - public function testDelete() + public function testDelete(): void { $endpoint = '/2.0/repositories/gentle/eof/refs/branches/abranch'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->branches->delete('gentle', 'eof', 'abranch'); diff --git a/test/Bitbucket/Tests/API/Repositories/Refs/TagsTest.php b/test/Bitbucket/Tests/API/Repositories/Refs/TagsTest.php index cbd055f..e393898 100644 --- a/test/Bitbucket/Tests/API/Repositories/Refs/TagsTest.php +++ b/test/Bitbucket/Tests/API/Repositories/Refs/TagsTest.php @@ -16,10 +16,10 @@ protected function setUp(): void $this->tags = $this->getApiMock(Tags::class); } - public function testAll() + public function testAll(): void { $endpoint = '/2.0/repositories/gentle/eof/refs/tags'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->tags->all('gentle', 'eof'); @@ -27,11 +27,11 @@ public function testAll() $this->assertResponse($expectedResult, $actual); } - public function testAllParams() + public function testAllParams(): void { $params = ['pagelen'=>36]; $endpoint = '/2.0/repositories/gentle/eof/refs/tags'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->tags->all('gentle', 'eof', $params); @@ -39,10 +39,10 @@ public function testAllParams() $this->assertResponse($expectedResult, $actual); } - public function testGet() + public function testGet(): void { $endpoint = '/2.0/repositories/gentle/eof/refs/tags/atag'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->tags->get('gentle', 'eof', 'atag'); @@ -50,10 +50,10 @@ public function testGet() $this->assertResponse($expectedResult, $actual); } - public function testCreate() + public function testCreate(): void { $endpoint = '/2.0/repositories/gentle/eof/refs/tags'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->tags->create('gentle', 'eof', 'atag', '2310abb944423ecf1a90be9888dafd096744b531'); diff --git a/test/Bitbucket/Tests/API/Repositories/RefsTest.php b/test/Bitbucket/Tests/API/Repositories/RefsTest.php index 1cdc801..63d40b6 100644 --- a/test/Bitbucket/Tests/API/Repositories/RefsTest.php +++ b/test/Bitbucket/Tests/API/Repositories/RefsTest.php @@ -16,10 +16,10 @@ protected function setUp(): void $this->refs = $this->getApiMock(Refs::class); } - public function testAll() + public function testAll(): void { $endpoint= '/2.0/repositories/gentle/eof/refs'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->refs->all('gentle', 'eof'); @@ -27,10 +27,10 @@ public function testAll() $this->assertResponse($expectedResult, $actual); } - public function testAllParams() + public function testAllParams(): void { $endpoint = '/2.0/repositories/gentle/eof/refs'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->refs->all('gentle', 'eof', ['pagelen' => 36]); diff --git a/test/Bitbucket/Tests/API/Repositories/RepositoryTest.php b/test/Bitbucket/Tests/API/Repositories/RepositoryTest.php index 484db2f..bba5b07 100644 --- a/test/Bitbucket/Tests/API/Repositories/RepositoryTest.php +++ b/test/Bitbucket/Tests/API/Repositories/RepositoryTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->repository = $this->getApiMock(Repository::class); } - public function testGetRepository() + public function testGetRepository(): void { $endpoint = '/2.0/repositories/gentle/eof'; $expectedResult = $this->fakeResponse(['dummy']); @@ -30,7 +30,7 @@ public function testGetRepository() /** * @return array of invalid value for repo creations parameter */ - public function invalidCreateProvider() + public function invalidCreateProvider(): array { return [ [''], @@ -53,14 +53,14 @@ public function invalidCreateProvider() * @dataProvider invalidCreateProvider * @ticket 27, 26 */ - public function testInvalidCreate($check) + public function testInvalidCreate($check): void { $this->expectException(\InvalidArgumentException::class); $this->repository->create('gentle', 'new-repo', $check); } - public function testCreateRepositoryFromJSON() + public function testCreateRepositoryFromJSON(): void { $endpoint = '/2.0/repositories/gentle/new-repo'; $params = json_encode([ @@ -76,7 +76,7 @@ public function testCreateRepositoryFromJSON() $this->assertRequest('POST', $endpoint, $params); } - public function testCreateRepositoryFromArray() + public function testCreateRepositoryFromArray(): void { $endpoint = '/2.0/repositories/gentle/new-repo'; $params = [ @@ -95,7 +95,7 @@ public function testCreateRepositoryFromArray() /** * @ticket 26 */ - public function testCreateRepositoryWithDefaultParams() + public function testCreateRepositoryWithDefaultParams(): void { $endpoint = '/2.0/repositories/gentle/new-repo'; $params = [ @@ -111,7 +111,7 @@ public function testCreateRepositoryWithDefaultParams() $this->assertRequest('POST', $endpoint, json_encode($params)); } - public function testUpdateRepositorySuccess() + public function testUpdateRepositorySuccess(): void { $endpoint = '/2.0/repositories/gentle/eof'; $params = [ @@ -126,7 +126,7 @@ public function testUpdateRepositorySuccess() $this->assertRequest('PUT', $endpoint, http_build_query($params)); } - public function testDeleteRepository() + public function testDeleteRepository(): void { $endpoint = '/2.0/repositories/gentle/eof'; @@ -135,7 +135,7 @@ public function testDeleteRepository() $this->assertRequest('DELETE', $endpoint); } - public function testGetRepositoryWatchers() + public function testGetRepositoryWatchers(): void { $endpoint = '/2.0/repositories/gentle/eof/watchers'; $expectedResult = $this->fakeResponse(['dummy']); @@ -146,7 +146,7 @@ public function testGetRepositoryWatchers() $this->assertResponse($expectedResult, $actual); } - public function testGetRepositoryForks() + public function testGetRepositoryForks(): void { $endpoint = '/2.0/repositories/gentle/eof/forks'; $expectedResult = $this->fakeResponse(['dummy']); @@ -157,7 +157,7 @@ public function testGetRepositoryForks() $this->assertResponse($expectedResult, $actual); } - public function testForkRepositorySuccess() + public function testForkRepositorySuccess(): void { $endpoint = '/2.0/repositories/gentle/eof/forks'; $params = [ @@ -170,10 +170,10 @@ public function testForkRepositorySuccess() $this->assertRequest('POST', $endpoint, json_encode($params)); } - public function testGetBranches() + public function testGetBranches(): void { $endpoint = '/2.0/repositories/gentle/eof/refs/branches/'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->repository->branches('gentle', 'eof'); @@ -181,10 +181,10 @@ public function testGetBranches() $this->assertResponse($expectedResult, $actual); } - public function testGetTags() + public function testGetTags(): void { $endpoint= '/2.0/repositories/gentle/eof/refs/tags/tagname'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->repository->tags('gentle', 'eof', 'tagname'); @@ -192,10 +192,10 @@ public function testGetTags() $this->assertResponse($expectedResult, $actual); } - public function testGetFileHistory() + public function testGetFileHistory(): void { $endpoint = '/2.0/repositories/gentle/eof/filehistory/1bc8345/lib/file.php'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->repository->filehistory('gentle', 'eof', '1bc8345', 'lib/file.php'); diff --git a/test/Bitbucket/Tests/API/Repositories/SrcTest.php b/test/Bitbucket/Tests/API/Repositories/SrcTest.php index 3bfa1f4..ea2d092 100644 --- a/test/Bitbucket/Tests/API/Repositories/SrcTest.php +++ b/test/Bitbucket/Tests/API/Repositories/SrcTest.php @@ -16,10 +16,10 @@ protected function setUp(): void $this->src = $this->getApiMock(Src::class); } - public function testListRepoSrc() + public function testListRepoSrc(): void { $endpoint = '/2.0/repositories/gentle/eof/src/1e10ffe//lib'; - $expectedResult = $this->fakeResponse(json_encode(['dummy'])); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->src->get('gentle', 'eof', '1e10ffe', '/lib'); @@ -27,10 +27,10 @@ public function testListRepoSrc() $this->assertResponse($expectedResult, $actual); } - public function testSrcGetRawContent() + public function testSrcGetRawContent(): void { $endpoint = '/2.0/repositories/gentle/eof/src/1e10ffe/lib/Gentle/Bitbucket/API/Repositories/Services.php'; - $expectedResult = $this->fakeResponse(json_encode(['dummy'])); + $expectedResult = $this->fakeResponse(['dummy']); $actual = $this->src->get('gentle', 'eof', '1e10ffe', 'lib/Gentle/Bitbucket/API/Repositories/Services.php'); @@ -41,14 +41,14 @@ public function testSrcGetRawContent() /** * @dataProvider srcInvalidParamsProvider */ - public function testSrcCreateWithInvalidParams($params) + public function testSrcCreateWithInvalidParams(array $params): void { $this->expectException(\InvalidArgumentException::class); $this->src->create('gentle', 'eof', $params); } - public function srcInvalidParamsProvider() + public function srcInvalidParamsProvider(): array { return [ [[]], @@ -56,7 +56,7 @@ public function srcInvalidParamsProvider() ]; } - public function testSrcCreateFile() + public function testSrcCreateFile(): void { $endpoint = '/2.0/repositories/gentle/eof/src'; $params = [ @@ -70,7 +70,7 @@ public function testSrcCreateFile() $this->assertRequest('POST', $endpoint, http_build_query($params)); } - public function testSrcCreateBranch() + public function testSrcCreateBranch(): void { $endpoint = '/2.0/repositories/gentle/eof/src'; $params = [ diff --git a/test/Bitbucket/Tests/API/RepositoriesTest.php b/test/Bitbucket/Tests/API/RepositoriesTest.php index e9371b5..d82d6aa 100644 --- a/test/Bitbucket/Tests/API/RepositoriesTest.php +++ b/test/Bitbucket/Tests/API/RepositoriesTest.php @@ -15,7 +15,7 @@ protected function setUp(): void $this->repositories = $this->getApiMock(Repositories::class); } - public function testGetAllRepositories() + public function testGetAllRepositories(): void { $endpoint = '/2.0/repositories/gentle'; $expectedResult = $this->fakeResponse(['dummy']); diff --git a/test/Bitbucket/Tests/API/Teams/HooksTest.php b/test/Bitbucket/Tests/API/Teams/HooksTest.php index 86ebbf0..7de861a 100644 --- a/test/Bitbucket/Tests/API/Teams/HooksTest.php +++ b/test/Bitbucket/Tests/API/Teams/HooksTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->hooks = $this->getApiMock(Hooks::class); } - public function invalidCreateProvider() + public function invalidCreateProvider(): array { return [ [[ @@ -51,14 +51,14 @@ public function invalidCreateProvider() /** * @dataProvider invalidCreateProvider */ - public function testInvalidCreate(array $check) + public function testInvalidCreate(array $check): void { $this->expectException(\InvalidArgumentException::class); $this->hooks->create('gentle', $check); } - public function testCreateSuccess() + public function testCreateSuccess(): void { $endpoint = '/2.0/teams/gentle/hooks'; $params = [ @@ -75,7 +75,7 @@ public function testCreateSuccess() $this->assertRequest('POST', $endpoint, json_encode($params)); } - public function testUpdateSuccess() + public function testUpdateSuccess(): void { $endpoint = '/2.0/teams/gentle/hooks/30b60aee-9cdf-407d-901c-2de106ee0c9d'; $params = [ @@ -95,14 +95,14 @@ public function testUpdateSuccess() /** * @dataProvider invalidCreateProvider */ - public function testInvalidUpdate(array $check) + public function testInvalidUpdate(array $check): void { $this->expectException(\InvalidArgumentException::class); $this->hooks->update('gentle', '30b60aee-9cdf-407d-901c-2de106ee0c9d', $check); } - public function testGetAllHooks() + public function testGetAllHooks(): void { $endpoint = '/2.0/teams/gentle/hooks'; $expectedResult = $this->fakeResponse(['dummy']); @@ -113,7 +113,7 @@ public function testGetAllHooks() $this->assertResponse($expectedResult, $actual); } - public function testGetSingleHook() + public function testGetSingleHook(): void { $endpoint = '/2.0/teams/gentle/hooks/30b60aee-9cdf-407d-901c-2de106ee0c9d'; $expectedResult = $this->fakeResponse(['dummy']); @@ -124,7 +124,7 @@ public function testGetSingleHook() $this->assertResponse($expectedResult, $actual); } - public function testDeleteSingleHook() + public function testDeleteSingleHook(): void { $endpoint = '/2.0/teams/gentle/hooks/30b60aee-9cdf-407d-901c-2de106ee0c9d'; diff --git a/test/Bitbucket/Tests/API/Teams/PermissionsTest.php b/test/Bitbucket/Tests/API/Teams/PermissionsTest.php index d88ad6a..aac5c4d 100644 --- a/test/Bitbucket/Tests/API/Teams/PermissionsTest.php +++ b/test/Bitbucket/Tests/API/Teams/PermissionsTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->permissions = $this->getApiMock(Permissions::class); } - public function testAll() + public function testAll(): void { $endpoint = '/2.0/teams/gentle/permissions'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testAll() $this->assertResponse($expectedResult, $actual); } - public function testRepositories() + public function testRepositories(): void { $endpoint = '/2.0/teams/gentle/permissions/repositories'; $expectedResult = $this->fakeResponse(['dummy']); @@ -38,7 +38,7 @@ public function testRepositories() $this->assertResponse($expectedResult, $actual); } - public function testRepository() + public function testRepository(): void { $endpoint = '/2.0/teams/gentle/permissions/repositories/eof'; $expectedResult = $this->fakeResponse(['dummy']); diff --git a/test/Bitbucket/Tests/API/TeamsTest.php b/test/Bitbucket/Tests/API/TeamsTest.php index 8725b65..c5c820a 100644 --- a/test/Bitbucket/Tests/API/TeamsTest.php +++ b/test/Bitbucket/Tests/API/TeamsTest.php @@ -15,7 +15,7 @@ protected function setUp(): void $this->teams = $this->getApiMock(Teams::class); } - public function invalidRoleProvider() + public function invalidRoleProvider(): array { return [ ['invalid'], @@ -30,15 +30,16 @@ public function invalidRoleProvider() /** * @dataProvider invalidRoleProvider + * @param int|string|bool|array $role */ - public function testGetTeamsListWithInvalidRole($role) + public function testGetTeamsListWithInvalidRole($role): void { $this->expectException(\InvalidArgumentException::class); $this->teams->all($role); } - public function testGetTeamsList() + public function testGetTeamsList(): void { $endpoint = '/2.0/teams'; $expectedResult = $this->fakeResponse(['dummy']); @@ -49,7 +50,7 @@ public function testGetTeamsList() $this->assertResponse($expectedResult, $actual); } - public function testGetTeamProfile() + public function testGetTeamProfile(): void { $endpoint = '/2.0/teams/gentle-web'; $expectedResult = $this->fakeResponse(['dummy']); @@ -60,7 +61,7 @@ public function testGetTeamProfile() $this->assertResponse($expectedResult, $actual); } - public function testGetTeamMembers() + public function testGetTeamMembers(): void { $endpoint = '/2.0/teams/gentle-web/members'; $expectedResult = $this->fakeResponse(['dummy']); @@ -71,7 +72,7 @@ public function testGetTeamMembers() $this->assertRequest('GET', $endpoint); } - public function testGetTeamFollowers() + public function testGetTeamFollowers(): void { $endpoint = '/2.0/teams/gentle-web/followers'; $expectedResult = $this->fakeResponse(['dummy']); @@ -82,7 +83,7 @@ public function testGetTeamFollowers() $this->assertRequest('GET', $endpoint); } - public function testGetTeamFollowing() + public function testGetTeamFollowing(): void { $endpoint = '/2.0/teams/gentle-web/following'; $expectedResult = $this->fakeResponse(['dummy']); @@ -93,7 +94,7 @@ public function testGetTeamFollowing() $this->assertRequest('GET', $endpoint); } - public function testGetTeamRepositories() + public function testGetTeamRepositories(): void { $endpoint = '/2.0/teams/gentle-web/repositories'; $expectedResult = $this->fakeResponse(['dummy']); @@ -104,12 +105,12 @@ public function testGetTeamRepositories() $this->assertRequest('GET', $endpoint); } - public function testHooks() + public function testHooks(): void { $this->assertInstanceOf(Teams\Hooks::class, $this->teams->hooks()); } - public function testPermissions() + public function testPermissions(): void { $this->assertInstanceOf(Teams\Permissions::class, $this->teams->permissions()); } diff --git a/test/Bitbucket/Tests/API/TestCase.php b/test/Bitbucket/Tests/API/TestCase.php index 9ac8ba3..ae4ea5c 100644 --- a/test/Bitbucket/Tests/API/TestCase.php +++ b/test/Bitbucket/Tests/API/TestCase.php @@ -2,6 +2,7 @@ namespace Bitbucket\Tests\API; +use Bitbucket\API\Api; use Bitbucket\API\Http\HttpPluginClientBuilder; use Http\Discovery\MessageFactoryDiscovery; use Http\Mock\Client; @@ -18,14 +19,14 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase * @param class-string $class * @return T */ - protected function getApiMock($class) + protected function getApiMock(string $class): Api { $bitbucketClient = new \Bitbucket\API\Http\Client(array(), $this->getHttpPluginClientBuilder()); return new $class([], $bitbucketClient); } - private function getMockHttpClient() + protected function getMockHttpClient(): Client { if (!isset($this->mockClient)) { $this->mockClient = new Client(); @@ -34,23 +35,26 @@ private function getMockHttpClient() return $this->mockClient; } - protected function getHttpPluginClientBuilder() + protected function getHttpPluginClientBuilder(): HttpPluginClientBuilder { return new HttpPluginClientBuilder($this->getMockHttpClient()); } - protected function fakeResponse($data, $statusCode = 200, $encodeResponse = true) + /** + * @param array $data + */ + protected function fakeResponse(array $data, int $statusCode = 200): ResponseInterface { $messageFactory = MessageFactoryDiscovery::find(); - $responseBody = $encodeResponse ? json_encode($data) : $data; + $responseBody = json_encode($data); $response = $messageFactory->createResponse($statusCode, null, [], $responseBody); $this->getMockHttpClient()->addResponse($response); return $response; } - protected function assertResponse(ResponseInterface $expected, ResponseInterface $actual) + protected function assertResponse(ResponseInterface $expected, ResponseInterface $actual): void { $this->assertSame($expected->getStatusCode(), $actual->getStatusCode()); $expected->getBody()->rewind(); @@ -60,7 +64,7 @@ protected function assertResponse(ResponseInterface $expected, ResponseInterface $this->assertSame($expectedContent, $actualContent); } - protected function assertRequest($method, $endpoint, $requestBody = '', $query = '') + protected function assertRequest(string $method, string $endpoint, string $requestBody = '', string $query = ''): void { /** @var RequestInterface $request */ $request = $this->mockClient->getLastRequest(); @@ -72,7 +76,10 @@ protected function assertRequest($method, $endpoint, $requestBody = '', $query = $this->assertSame($query, $request->getUri()->getQuery()); } - protected function getMethod($class, $name) + /** + * @param class-string $class + */ + protected function getMethod(string $class, string $name): \ReflectionMethod { $class = new \ReflectionClass($class); $method = $class->getMethod($name); diff --git a/test/Bitbucket/Tests/API/User/PermissionsTest.php b/test/Bitbucket/Tests/API/User/PermissionsTest.php index 0523a71..0ade272 100644 --- a/test/Bitbucket/Tests/API/User/PermissionsTest.php +++ b/test/Bitbucket/Tests/API/User/PermissionsTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->permissions = $this->getApiMock(Permissions::class); } - public function testTeams() + public function testTeams(): void { $endpoint = '/2.0/user/permissions/teams'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testTeams() $this->assertResponse($expectedResult, $actual); } - public function testRepositories() + public function testRepositories(): void { $endpoint = '/2.0/user/permissions/repositories'; $expectedResult = $this->fakeResponse(['dummy']); diff --git a/test/Bitbucket/Tests/API/UserTest.php b/test/Bitbucket/Tests/API/UserTest.php index 2dc7a11..6c80a81 100644 --- a/test/Bitbucket/Tests/API/UserTest.php +++ b/test/Bitbucket/Tests/API/UserTest.php @@ -15,7 +15,7 @@ protected function setUp(): void $this->user = $this->getApiMock(User::class); } - public function testGetEmails() + public function testGetEmails(): void { $endpoint = '/2.0/user/emails'; $expectedResult = $this->fakeResponse(['dummy']); @@ -26,10 +26,10 @@ public function testGetEmails() $this->assertResponse($expectedResult, $actual); } - public function testGetUserProfileSuccess() + public function testGetUserProfileSuccess(): void { $endpoint = '/2.0/user/'; - $expectedResult = $this->fakeResponse(json_encode('dumy')); + $expectedResult = $this->fakeResponse([]); $actual = $this->user->get(); @@ -37,7 +37,7 @@ public function testGetUserProfileSuccess() $this->assertResponse($expectedResult, $actual); } - public function testPermissions() + public function testPermissions(): void { $this->assertInstanceOf(User\Permissions::class, $this->user->permissions()); } diff --git a/test/Bitbucket/Tests/API/Users/InvitationsTest.php b/test/Bitbucket/Tests/API/Users/InvitationsTest.php index 4ccd4ab..2f434db 100644 --- a/test/Bitbucket/Tests/API/Users/InvitationsTest.php +++ b/test/Bitbucket/Tests/API/Users/InvitationsTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->invitations = $this->getApiMock(Invitations::class); } - public function testGetAllInvitations() + public function testGetAllInvitations(): void { $endpoint = '/1.0/users/gentle/invitations'; $expectedResult = $this->fakeResponse(['dummy']); @@ -27,7 +27,7 @@ public function testGetAllInvitations() $this->assertResponse($expectedResult, $actual); } - public function testIssuesNewInvitationSuccess() + public function testIssuesNewInvitationSuccess(): void { $endpoint = '/1.0/users/gentle/invitations'; $expectedResult = $this->fakeResponse(['dummy']); @@ -39,7 +39,7 @@ public function testIssuesNewInvitationSuccess() $this->assertResponse($expectedResult, $actual); } - public function testDeleteInvitationByEmailSuccess() + public function testDeleteInvitationByEmailSuccess(): void { $endpoint = '/1.0/users/gentle/invitations'; $expectedResult = $this->fakeResponse(['dummy']); @@ -51,7 +51,7 @@ public function testDeleteInvitationByEmailSuccess() $this->assertResponse($expectedResult, $actual); } - public function testDeleteInvitationByGroupSuccess() + public function testDeleteInvitationByGroupSuccess(): void { $endpoint = '/1.0/users/gentle/invitations'; $expectedResult = $this->fakeResponse(['dummy']); diff --git a/test/Bitbucket/Tests/API/Users/SshKeysTest.php b/test/Bitbucket/Tests/API/Users/SshKeysTest.php index 93d0c6a..9c4b5ee 100644 --- a/test/Bitbucket/Tests/API/Users/SshKeysTest.php +++ b/test/Bitbucket/Tests/API/Users/SshKeysTest.php @@ -16,10 +16,10 @@ protected function setUp(): void $this->sshKeys = $this->getApiMock(SshKeys::class); } - public function testGetAllSshKeys() + public function testGetAllSshKeys(): void { $endpoint = '/2.0/users/gentle/ssh-keys'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse([]); $actual = $this->sshKeys->all('gentle'); @@ -27,10 +27,10 @@ public function testGetAllSshKeys() $this->assertResponse($expectedResult, $actual); } - public function testCreateSshKey() + public function testCreateSshKey(): void { $endpoint = '/2.0/users/gentle/ssh-keys'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse([]); $params = [ 'key' => 'key content', 'label' => 'dummy key' @@ -42,10 +42,10 @@ public function testCreateSshKey() $this->assertResponse($expectedResult, $actual); } - public function testUpdateSshKey() + public function testUpdateSshKey(): void { $endpoint = '/2.0/users/gentle/ssh-keys/12'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse([]); $params = [ 'key' => 'key content' ]; @@ -56,10 +56,10 @@ public function testUpdateSshKey() $this->assertResponse($expectedResult, $actual); } - public function testGetSshKeyContent() + public function testGetSshKeyContent(): void { $endpoint = '/2.0/users/gentle/ssh-keys/2'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse([]); $actual = $this->sshKeys->get('gentle', 2); @@ -67,10 +67,10 @@ public function testGetSshKeyContent() $this->assertResponse($expectedResult, $actual); } - public function testDeleteSshKey() + public function testDeleteSshKey(): void { $endpoint = '/2.0/users/gentle/ssh-keys/2'; - $expectedResult = $this->fakeResponse('dummy'); + $expectedResult = $this->fakeResponse([]); $actual = $this->sshKeys->delete('gentle', 2); diff --git a/test/Bitbucket/Tests/API/UsersTest.php b/test/Bitbucket/Tests/API/UsersTest.php index da5614b..855a780 100644 --- a/test/Bitbucket/Tests/API/UsersTest.php +++ b/test/Bitbucket/Tests/API/UsersTest.php @@ -15,7 +15,7 @@ protected function setUp(): void $this->users = $this->getApiMock(Users::class); } - public function testGetUserPublicInformation() + public function testGetUserPublicInformation(): void { $endpoint = '/2.0/users/john-doe'; $expectedResult = $this->fakeResponse(['dummy']); @@ -26,7 +26,7 @@ public function testGetUserPublicInformation() $this->assertResponse($expectedResult, $actual); } - public function testGetUserRepositories() + public function testGetUserRepositories(): void { $endpoint = '/2.0/repositories/john-doe'; $expectedResult = $this->fakeResponse(['dummy']); @@ -37,12 +37,12 @@ public function testGetUserRepositories() $this->assertResponse($expectedResult, $actual); } - public function testGetInvitationsInstance() + public function testGetInvitationsInstance(): void { $this->assertInstanceOf(Users\Invitations::class, $this->users->invitations()); } - public function testGetSshKeysInstance() + public function testGetSshKeysInstance(): void { $this->assertInstanceOf(Users\SshKeys::class, $this->users->sshKeys()); } diff --git a/test/Bitbucket/Tests/API/Workspaces/HooksTest.php b/test/Bitbucket/Tests/API/Workspaces/HooksTest.php index 22f9be1..32eba53 100644 --- a/test/Bitbucket/Tests/API/Workspaces/HooksTest.php +++ b/test/Bitbucket/Tests/API/Workspaces/HooksTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->hooks = $this->getApiMock(Hooks::class); } - public function invalidCreateProvider() + public function invalidCreateProvider(): array { return [ [[ @@ -51,7 +51,7 @@ public function invalidCreateProvider() /** * @dataProvider invalidCreateProvider */ - public function testInvalidCreate(array $check) + public function testInvalidCreate(array $check): void { $this->expectException(\InvalidArgumentException::class); diff --git a/test/Bitbucket/Tests/API/Workspaces/WorkspaceTest.php b/test/Bitbucket/Tests/API/Workspaces/WorkspaceTest.php index 5e5b537..827e0d3 100644 --- a/test/Bitbucket/Tests/API/Workspaces/WorkspaceTest.php +++ b/test/Bitbucket/Tests/API/Workspaces/WorkspaceTest.php @@ -17,7 +17,7 @@ protected function setUp(): void $this->workspace = $this->getApiMock(Workspace::class); } - public function testGetWorkspace() + public function testGetWorkspace(): void { $endpoint = '/2.0/workspaces/gentle-web'; $expectedResult = $this->fakeResponse(['dummy']); @@ -28,7 +28,7 @@ public function testGetWorkspace() $this->assertResponse($expectedResult, $actual); } - public function testGetWorkspaceMembers() + public function testGetWorkspaceMembers(): void { $endpoint = '/2.0/workspaces/gentle-web/members'; $expectedResult = $this->fakeResponse(['dummy']); @@ -39,7 +39,7 @@ public function testGetWorkspaceMembers() $this->assertRequest('GET', $endpoint); } - public function testGetWorkspaceProjects() + public function testGetWorkspaceProjects(): void { $endpoint = '/2.0/workspaces/gentle-web/projects'; $expectedResult = $this->fakeResponse(['dummy']); @@ -50,7 +50,7 @@ public function testGetWorkspaceProjects() $this->assertRequest('GET', $endpoint); } - public function testHooks() + public function testHooks(): void { $this->assertInstanceOf(Hooks::class, $this->workspace->hooks()); } diff --git a/test/Bitbucket/Tests/API/WorkspacesTest.php b/test/Bitbucket/Tests/API/WorkspacesTest.php index 3a7e92d..942ee52 100644 --- a/test/Bitbucket/Tests/API/WorkspacesTest.php +++ b/test/Bitbucket/Tests/API/WorkspacesTest.php @@ -15,7 +15,7 @@ protected function setUp(): void $this->workspaces = $this->getApiMock(Workspaces::class); } - public function testGetWorkspacesList() + public function testGetWorkspacesList(): void { $endpoint = '/2.0/workspaces'; $expectedResult = $this->fakeResponse(['dummy']);