From 0077a9fd34a99e499da355e3da2f19a7fd57650c Mon Sep 17 00:00:00 2001 From: Jeroen Thora Date: Tue, 13 Aug 2019 16:28:56 +0200 Subject: [PATCH] Bump phpunit to supported version --- .gitignore | 1 + composer.json | 2 +- phpunit.xml.dist | 1 - test/Github/Tests/Api/AbstractApiTest.php | 4 ++-- .../Tests/Api/CurrentUser/DeployKeysTest.php | 9 ++++++--- .../Tests/Api/CurrentUser/EmailsTest.php | 9 ++++++--- .../Tests/Api/CurrentUser/FollowersTest.php | 4 +++- .../Tests/Api/CurrentUser/MembershipsTest.php | 4 +++- .../Tests/Api/CurrentUser/StarringTest.php | 4 +++- .../Tests/Api/CurrentUser/WatchersTest.php | 4 +++- test/Github/Tests/Api/DeploymentTest.php | 4 +++- test/Github/Tests/Api/GistsTest.php | 4 +++- test/Github/Tests/Api/GitData/BlobsTest.php | 9 ++++++--- test/Github/Tests/Api/GitData/CommitsTest.php | 11 +++++++---- .../Tests/Api/GitData/ReferencesTest.php | 11 +++++++---- test/Github/Tests/Api/GitData/TagsTest.php | 19 +++++++++++-------- test/Github/Tests/Api/GitData/TreesTest.php | 17 ++++++++++------- test/Github/Tests/Api/Issue/AssigneesTest.php | 5 +++-- test/Github/Tests/Api/Issue/CommentsTest.php | 5 +++-- test/Github/Tests/Api/Issue/LabelsTest.php | 3 ++- .../Github/Tests/Api/Issue/MilestonesTest.php | 3 ++- test/Github/Tests/Api/IssueTest.php | 4 +++- .../Tests/Api/Organization/HooksTest.php | 7 ++++--- .../Tests/Api/Organization/ProjectsTest.php | 3 ++- .../Tests/Api/Organization/TeamsTest.php | 5 +++-- test/Github/Tests/Api/Project/CardsTest.php | 3 ++- test/Github/Tests/Api/Project/ColumnsTest.php | 7 ++++--- .../Tests/Api/PullRequest/CommentsTest.php | 11 ++++++----- .../Tests/Api/PullRequest/ReviewTest.php | 9 +++++---- test/Github/Tests/Api/PullRequestTest.php | 10 ++++++---- test/Github/Tests/Api/RateLimitTest.php | 4 +--- .../Tests/Api/Repository/AssetsTest.php | 3 ++- .../Tests/Api/Repository/ChecksTest.php | 5 +++-- .../Tests/Api/Repository/CommentsTest.php | 5 +++-- .../Tests/Api/Repository/ContentsTest.php | 15 ++++++++------- .../Tests/Api/Repository/DeployKeysTest.php | 9 +++++---- .../Github/Tests/Api/Repository/HooksTest.php | 7 ++++--- .../Tests/Api/Repository/LabelsTest.php | 9 +++++---- .../Tests/Api/Repository/ProjectsTest.php | 3 ++- .../Tests/Api/Repository/ReleasesTest.php | 3 ++- .../Tests/Api/Repository/StatusesTest.php | 3 ++- .../Tests/Api/Repository/TrafficTest.php | 2 ++ test/Github/Tests/Api/TestCase.php | 2 +- test/Github/Tests/ClientTest.php | 7 ++++--- .../{ => Plugin}/PathPrependTest.php | 0 test/Github/Tests/Integration/GistTest.php | 4 +++- .../Tests/Integration/RateLimitTest.php | 5 +++-- test/Github/Tests/Integration/RepoTest.php | 6 +++--- test/Github/Tests/Integration/TestCase.php | 2 +- test/Github/Tests/Integration/UserTest.php | 8 +++++--- 50 files changed, 179 insertions(+), 115 deletions(-) rename test/Github/Tests/HttpClient/{ => Plugin}/PathPrependTest.php (100%) diff --git a/.gitignore b/.gitignore index 2c9d04ccd11..ebe7b7ea7a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .php_cs.cache phpunit.xml +.phpunit.result.cache composer.lock composer.phar vendor/* diff --git a/composer.json b/composer.json index 238b6aba771..af0e7df5ad9 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "php-http/cache-plugin": "^1.4" }, "require-dev": { - "phpunit/phpunit": "^6.0", + "phpunit/phpunit": "^7.0 || ^8.0", "php-http/guzzle6-adapter": "^1.0", "php-http/mock-client": "^1.0", "guzzlehttp/psr7": "^1.2", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c390af0e017..3b6dc204b03 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="vendor/autoload.php" > diff --git a/test/Github/Tests/Api/AbstractApiTest.php b/test/Github/Tests/Api/AbstractApiTest.php index e4ce3ae9171..ec8dd1e0be0 100644 --- a/test/Github/Tests/Api/AbstractApiTest.php +++ b/test/Github/Tests/Api/AbstractApiTest.php @@ -171,13 +171,13 @@ public function shouldNotPassEmptyRefToClient() $api = $this->getAbstractApiObject($client); $actual = $this->getMethod($api, 'get')->invokeArgs($api, ['/path', ['ref' => null]]); - $this->assertInternalType('array', $actual); + $this->assertIsArray($actual); } /** * @param $client * - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ protected function getAbstractApiObject($client) { diff --git a/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php b/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php index 7b1abd37923..4f147e25e02 100644 --- a/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php +++ b/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php @@ -1,6 +1,9 @@ expectException(MissingArgumentException::class); $data = ['key' => 'ssh-rsa ...']; $api = $this->getApiMock(); @@ -70,10 +73,10 @@ public function shouldNotCreateKeyWithoutTitleParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateKeyWithoutKeyParam() { + $this->expectException(MissingArgumentException::class); $data = ['title' => 'my key']; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/CurrentUser/EmailsTest.php b/test/Github/Tests/Api/CurrentUser/EmailsTest.php index 2cc4c746712..1fed2a0d780 100644 --- a/test/Github/Tests/Api/CurrentUser/EmailsTest.php +++ b/test/Github/Tests/Api/CurrentUser/EmailsTest.php @@ -1,6 +1,9 @@ expectException(InvalidArgumentException::class); $api = $this->getApiMock(); $api->expects($this->any()) ->method('delete'); @@ -99,10 +102,10 @@ public function shouldAddEmails() /** * @test - * @expectedException \Github\Exception\InvalidArgumentException */ public function shouldNotAddEmailsWhenAreNotPass() { + $this->expectException(InvalidArgumentException::class); $api = $this->getApiMock(); $api->expects($this->any()) ->method('post'); diff --git a/test/Github/Tests/Api/CurrentUser/FollowersTest.php b/test/Github/Tests/Api/CurrentUser/FollowersTest.php index 0ad32693008..19b4b0faab6 100644 --- a/test/Github/Tests/Api/CurrentUser/FollowersTest.php +++ b/test/Github/Tests/Api/CurrentUser/FollowersTest.php @@ -1,6 +1,8 @@ expectException(MissingArgumentException::class); $api = $this->getApiMock(); $statusData = ['description' => 'waiting to start']; diff --git a/test/Github/Tests/Api/GistsTest.php b/test/Github/Tests/Api/GistsTest.php index e0fba63a6c9..093af712911 100644 --- a/test/Github/Tests/Api/GistsTest.php +++ b/test/Github/Tests/Api/GistsTest.php @@ -2,6 +2,8 @@ namespace Github\Tests\Api; +use Github\Exception\MissingArgumentException; + class GistsTest extends TestCase { /** @@ -128,10 +130,10 @@ public function shouldListGistForks() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateGistWithoutFile() { + $this->expectException(MissingArgumentException::class); $input = [ 'description' => '', 'public' => false, diff --git a/test/Github/Tests/Api/GitData/BlobsTest.php b/test/Github/Tests/Api/GitData/BlobsTest.php index a871414f96b..368d47c3cc2 100644 --- a/test/Github/Tests/Api/GitData/BlobsTest.php +++ b/test/Github/Tests/Api/GitData/BlobsTest.php @@ -1,6 +1,9 @@ expectException(MissingArgumentException::class); $data = ['content' => 'some cotent']; $api = $this->getApiMock(); @@ -82,10 +85,10 @@ public function shouldNotCreateBlobWithoutEncoding() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateBlobWithoutContent() { + $this->expectException(MissingArgumentException::class); $data = ['encoding' => 'utf8']; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/GitData/CommitsTest.php b/test/Github/Tests/Api/GitData/CommitsTest.php index 3d973c6ab59..20903f3e1f2 100644 --- a/test/Github/Tests/Api/GitData/CommitsTest.php +++ b/test/Github/Tests/Api/GitData/CommitsTest.php @@ -1,6 +1,9 @@ expectException(MissingArgumentException::class); $data = ['tree' => 1234, 'parents' => []]; $api = $this->getApiMock(); @@ -54,10 +57,10 @@ public function shouldNotCreateCommitWithoutMessageParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateCommitWithoutTreeParam() { + $this->expectException(MissingArgumentException::class); $data = ['message' => 'some message', 'parents' => []]; $api = $this->getApiMock(); @@ -69,10 +72,10 @@ public function shouldNotCreateCommitWithoutTreeParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateCommitWithoutParentsParam() { + $this->expectException(MissingArgumentException::class); $data = ['message' => 'some message', 'tree' => '12334']; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/GitData/ReferencesTest.php b/test/Github/Tests/Api/GitData/ReferencesTest.php index 55a3fa0edd6..768085f69bf 100644 --- a/test/Github/Tests/Api/GitData/ReferencesTest.php +++ b/test/Github/Tests/Api/GitData/ReferencesTest.php @@ -1,6 +1,9 @@ expectException(MissingArgumentException::class); $data = ['ref' => '123']; $api = $this->getApiMock(); @@ -134,10 +137,10 @@ public function shouldNotCreateReferenceWithoutShaParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateReferenceWithoutRefsParam() { + $this->expectException(MissingArgumentException::class); $data = ['sha' => '1234']; $api = $this->getApiMock(); @@ -166,10 +169,10 @@ public function shouldUpdateReference() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNoUpdateReferenceWithoutSha() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/GitData/TagsTest.php b/test/Github/Tests/Api/GitData/TagsTest.php index acc8dab6550..83230175554 100644 --- a/test/Github/Tests/Api/GitData/TagsTest.php +++ b/test/Github/Tests/Api/GitData/TagsTest.php @@ -1,6 +1,9 @@ expectException(MissingArgumentException::class); $data = [ 'tag' => 'v2.2', 'object' => 'test', @@ -108,10 +111,10 @@ public function shouldCreateTagWithoutTaggerParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTagWithoutTaggerNameParam() { + $this->expectException(MissingArgumentException::class); $data = [ 'message' => 'some message', 'tag' => 'v2.2', @@ -132,10 +135,10 @@ public function shouldNotCreateTagWithoutTaggerNameParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTagWithoutTaggerEmailParam() { + $this->expectException(MissingArgumentException::class); $data = [ 'message' => 'some message', 'tag' => 'v2.2', @@ -156,10 +159,10 @@ public function shouldNotCreateTagWithoutTaggerEmailParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTagWithoutTaggerDateParam() { + $this->expectException(MissingArgumentException::class); $data = [ 'message' => 'some message', 'tag' => 'v2.2', @@ -180,10 +183,10 @@ public function shouldNotCreateTagWithoutTaggerDateParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTagWithoutTagParam() { + $this->expectException(MissingArgumentException::class); $data = [ 'message' => 'some message', 'object' => 'test', @@ -204,10 +207,10 @@ public function shouldNotCreateTagWithoutTagParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTagWithoutObjectParam() { + $this->expectException(MissingArgumentException::class); $data = [ 'message' => 'some message', 'tag' => 'v2.2', @@ -228,10 +231,10 @@ public function shouldNotCreateTagWithoutObjectParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTagWithoutTypeParam() { + $this->expectException(MissingArgumentException::class); $data = [ 'message' => 'some message', 'tag' => 'v2.2', diff --git a/test/Github/Tests/Api/GitData/TreesTest.php b/test/Github/Tests/Api/GitData/TreesTest.php index 58ef5cef2a0..901af559e24 100644 --- a/test/Github/Tests/Api/GitData/TreesTest.php +++ b/test/Github/Tests/Api/GitData/TreesTest.php @@ -1,6 +1,9 @@ expectException(MissingArgumentException::class); $data = [ 'tree' => [ 'path' => 'path', @@ -107,10 +110,10 @@ public function shouldNotCreateTreeWithoutShaAndContentParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTreeWithoutPathParam() { + $this->expectException(MissingArgumentException::class); $data = [ 'tree' => [ 'mode' => 'mode', @@ -128,10 +131,10 @@ public function shouldNotCreateTreeWithoutPathParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTreeWithoutModeParam() { + $this->expectException(MissingArgumentException::class); $data = [ 'tree' => [ 'path' => 'path', @@ -149,10 +152,10 @@ public function shouldNotCreateTreeWithoutModeParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTreeWithoutTypeParam() { + $this->expectException(MissingArgumentException::class); $data = [ 'tree' => [ 'path' => 'path', @@ -170,10 +173,10 @@ public function shouldNotCreateTreeWithoutTypeParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTreeWithoutTreeParam() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); @@ -185,10 +188,10 @@ public function shouldNotCreateTreeWithoutTreeParam() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTreeWhenTreeParamIsNotArray() { + $this->expectException(MissingArgumentException::class); $data = [ 'tree' => '', ]; diff --git a/test/Github/Tests/Api/Issue/AssigneesTest.php b/test/Github/Tests/Api/Issue/AssigneesTest.php index 8777f0923b2..b6939a1b59e 100644 --- a/test/Github/Tests/Api/Issue/AssigneesTest.php +++ b/test/Github/Tests/Api/Issue/AssigneesTest.php @@ -3,6 +3,7 @@ namespace Github\Tests\Api\Issue; use Github\Api\Issue\Assignees; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class AssigneesTest extends TestCase @@ -35,10 +36,10 @@ public function shouldCheckAssignee() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotAddAssigneeMissingParameter() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); @@ -67,10 +68,10 @@ public function shouldAddAssignee() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotRemoveAssigneeMissingParameter() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Issue/CommentsTest.php b/test/Github/Tests/Api/Issue/CommentsTest.php index 51c67fe8f85..df8e5130937 100644 --- a/test/Github/Tests/Api/Issue/CommentsTest.php +++ b/test/Github/Tests/Api/Issue/CommentsTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Issue; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class CommentsTest extends TestCase @@ -40,10 +41,10 @@ public function shouldShowIssueComment() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateWithoutBody() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); @@ -72,10 +73,10 @@ public function shouldCreateIssueComment() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotUpdateWithoutBody() { + $this->expectException(MissingArgumentException::class); $data = ['somedata']; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Issue/LabelsTest.php b/test/Github/Tests/Api/Issue/LabelsTest.php index af8f14c67cb..ec55ccc54cb 100644 --- a/test/Github/Tests/Api/Issue/LabelsTest.php +++ b/test/Github/Tests/Api/Issue/LabelsTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Issue; +use Github\Exception\InvalidArgumentException; use Github\Tests\Api\TestCase; class LabelsTest extends TestCase @@ -191,10 +192,10 @@ public function shouldReplaceLabels() /** * @test - * @expectedException \Github\Exception\InvalidArgumentException */ public function shouldNotAddWhenDoNotHaveLabelsToAdd() { + $this->expectException(InvalidArgumentException::class); $api = $this->getApiMock(); $api->expects($this->any()) ->method('post'); diff --git a/test/Github/Tests/Api/Issue/MilestonesTest.php b/test/Github/Tests/Api/Issue/MilestonesTest.php index 18963580b8a..6a1996e0bbc 100644 --- a/test/Github/Tests/Api/Issue/MilestonesTest.php +++ b/test/Github/Tests/Api/Issue/MilestonesTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Issue; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class MilestonesTest extends TestCase @@ -41,10 +42,10 @@ public function shouldCreateMilestone() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateMilestoneWithoutTitle() { + $this->expectException(MissingArgumentException::class); $expectedValue = [['title' => 'milestone']]; $data = []; diff --git a/test/Github/Tests/Api/IssueTest.php b/test/Github/Tests/Api/IssueTest.php index 2fed3618853..b976f402451 100644 --- a/test/Github/Tests/Api/IssueTest.php +++ b/test/Github/Tests/Api/IssueTest.php @@ -2,6 +2,8 @@ namespace Github\Tests\Api; +use Github\Exception\MissingArgumentException; + class IssueTest extends TestCase { /** @@ -88,10 +90,10 @@ public function shouldCreateIssue() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateIssueWithoutTitle() { + $this->expectException(MissingArgumentException::class); $data = [ 'body' => 'some body', ]; diff --git a/test/Github/Tests/Api/Organization/HooksTest.php b/test/Github/Tests/Api/Organization/HooksTest.php index 5c905ece70f..82d586a087e 100644 --- a/test/Github/Tests/Api/Organization/HooksTest.php +++ b/test/Github/Tests/Api/Organization/HooksTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Organization; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class HooksTest extends TestCase @@ -56,10 +57,10 @@ public function shouldRemoveHook() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateHookWithoutName() { + $this->expectException(MissingArgumentException::class); $data = ['config' => 'conf']; $api = $this->getApiMock(); @@ -71,10 +72,10 @@ public function shouldNotCreateHookWithoutName() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateHookWithoutConfig() { + $this->expectException(MissingArgumentException::class); $data = ['name' => 'test']; $api = $this->getApiMock(); @@ -103,10 +104,10 @@ public function shouldCreateHook() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotUpdateHookWithoutConfig() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Organization/ProjectsTest.php b/test/Github/Tests/Api/Organization/ProjectsTest.php index 8ac5bf52229..05d607e34d8 100644 --- a/test/Github/Tests/Api/Organization/ProjectsTest.php +++ b/test/Github/Tests/Api/Organization/ProjectsTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Organization; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class ProjectsTest extends TestCase @@ -24,10 +25,10 @@ public function shouldGetAllRepositoryProjects() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateWithoutName() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Organization/TeamsTest.php b/test/Github/Tests/Api/Organization/TeamsTest.php index 4cff3609764..3c5474181e7 100644 --- a/test/Github/Tests/Api/Organization/TeamsTest.php +++ b/test/Github/Tests/Api/Organization/TeamsTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Organization; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class TeamsTest extends TestCase @@ -184,10 +185,10 @@ public function shouldRemoveTeamRepository() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateTeamWithoutName() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); @@ -250,10 +251,10 @@ public function shouldCreateWithPullPermissionWhenPermissionParamNotRecognized() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotUpdateTeamWithoutName() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Project/CardsTest.php b/test/Github/Tests/Api/Project/CardsTest.php index 6195f1b3514..8b3b37090db 100644 --- a/test/Github/Tests/Api/Project/CardsTest.php +++ b/test/Github/Tests/Api/Project/CardsTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Project; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class CardsTest extends TestCase @@ -90,10 +91,10 @@ public function shouldRemoveCard() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotMoveWithoutPosition() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Project/ColumnsTest.php b/test/Github/Tests/Api/Project/ColumnsTest.php index 7ce3a1693f2..7df1225190b 100644 --- a/test/Github/Tests/Api/Project/ColumnsTest.php +++ b/test/Github/Tests/Api/Project/ColumnsTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Project; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class ColumnsTest extends TestCase @@ -40,10 +41,10 @@ public function shouldShowColumn() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateWithoutName() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); @@ -72,10 +73,10 @@ public function shouldCreateColumn() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotUpdateWithoutName() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); @@ -120,10 +121,10 @@ public function shouldRemoveCard() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotMoveWithoutPosition() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/PullRequest/CommentsTest.php b/test/Github/Tests/Api/PullRequest/CommentsTest.php index 872934260d1..b9a7ec59514 100644 --- a/test/Github/Tests/Api/PullRequest/CommentsTest.php +++ b/test/Github/Tests/Api/PullRequest/CommentsTest.php @@ -3,6 +3,7 @@ namespace Github\Tests\Api\PullRequest; use Github\Api\PullRequest\Comments; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class CommentsTest extends TestCase @@ -266,10 +267,10 @@ public function shouldCreateReviewComment() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateReviewCommentWithoutCommitId() { + $this->expectException(MissingArgumentException::class); $data = [ 'path' => 'file1.txt', 'position' => 4, @@ -287,10 +288,10 @@ public function shouldNotCreateReviewCommentWithoutCommitId() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateReviewCommentWithoutPath() { + $this->expectException(MissingArgumentException::class); $data = [ 'commit_id' => '6dcb09b5b57875f334f61aebed695e2e4193db5e', 'position' => 4, @@ -308,10 +309,10 @@ public function shouldNotCreateReviewCommentWithoutPath() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateReviewCommentWithoutPosition() { + $this->expectException(MissingArgumentException::class); $data = [ 'commit_id' => '6dcb09b5b57875f334f61aebed695e2e4193db5e', 'path' => 'file1.txt', @@ -329,10 +330,10 @@ public function shouldNotCreateReviewCommentWithoutPosition() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateReviewCommentWithoutBody() { + $this->expectException(MissingArgumentException::class); $data = [ 'commit_id' => '6dcb09b5b57875f334f61aebed695e2e4193db5e', 'path' => 'file1.txt', @@ -414,10 +415,10 @@ public function shouldUpdateReviewComment() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotUpdateReviewCommentWithoutBody() { + $this->expectException(MissingArgumentException::class); $expectedValue = [ 'url' => 'https://api.github.com/repos/octocat/Hello-World/pulls/comments/1', 'id' => 1, diff --git a/test/Github/Tests/Api/PullRequest/ReviewTest.php b/test/Github/Tests/Api/PullRequest/ReviewTest.php index 829f0c8dcaf..eb94203bc68 100644 --- a/test/Github/Tests/Api/PullRequest/ReviewTest.php +++ b/test/Github/Tests/Api/PullRequest/ReviewTest.php @@ -2,8 +2,9 @@ namespace Github\Tests\Api\PullRequest; -use Github\Api\PullRequest\Comments; use Github\Api\PullRequest\Review; +use Github\Exception\InvalidArgumentException; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class ReviewTest extends TestCase @@ -231,10 +232,10 @@ public function shouldCreatePendingReviewWithoutEvent() /** * @test - * @expectedException \Github\Exception\InvalidArgumentException */ public function shouldNotCreateReviewWithInvalidEvent() { + $this->expectException(InvalidArgumentException::class); $data = [ 'event' => 'DISMISSED', 'body' => 'Nice change', @@ -306,10 +307,10 @@ public function shouldSubmitReviewComment() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotSubmitReviewWithoutEvent() { + $this->expectException(MissingArgumentException::class); $data = [ 'body' => 'Nice change', ]; @@ -325,10 +326,10 @@ public function shouldNotSubmitReviewWithoutEvent() /** * @test - * @expectedException \Github\Exception\InvalidArgumentException */ public function shouldNotSubmitReviewWithInvalidEvent() { + $this->expectException(InvalidArgumentException::class); $data = [ 'event' => 'DISMISSED', 'body' => 'Nice change', diff --git a/test/Github/Tests/Api/PullRequestTest.php b/test/Github/Tests/Api/PullRequestTest.php index a3486d1f301..3f2acceb913 100644 --- a/test/Github/Tests/Api/PullRequestTest.php +++ b/test/Github/Tests/Api/PullRequestTest.php @@ -2,6 +2,8 @@ namespace Github\Tests\Api; +use Github\Exception\MissingArgumentException; + class PullRequestTest extends TestCase { /** @@ -244,10 +246,10 @@ public function shouldCreatePullRequestUsingIssueId() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreatePullRequestWithoutBase() { + $this->expectException(MissingArgumentException::class); $data = [ 'head' => 'virtualtestbranch', 'title' => 'TITLE: Testing pull-request creation from PHP Github API', @@ -263,10 +265,10 @@ public function shouldNotCreatePullRequestWithoutBase() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreatePullRequestWithoutHead() { + $this->expectException(MissingArgumentException::class); $data = [ 'base' => 'master', 'title' => 'TITLE: Testing pull-request creation from PHP Github API', @@ -282,10 +284,10 @@ public function shouldNotCreatePullRequestWithoutHead() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreatePullRequestUsingTitleButWithoutBody() { + $this->expectException(MissingArgumentException::class); $data = [ 'base' => 'master', 'head' => 'virtualtestbranch', @@ -301,10 +303,10 @@ public function shouldNotCreatePullRequestUsingTitleButWithoutBody() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreatePullRequestWithoutIssueIdOrTitle() { + $this->expectException(MissingArgumentException::class); $data = [ 'base' => 'master', 'head' => 'virtualtestbranch', diff --git a/test/Github/Tests/Api/RateLimitTest.php b/test/Github/Tests/Api/RateLimitTest.php index 1c3a1f3c3dd..547b5dc2797 100644 --- a/test/Github/Tests/Api/RateLimitTest.php +++ b/test/Github/Tests/Api/RateLimitTest.php @@ -41,10 +41,8 @@ class RateLimitTest extends TestCase * * {@inheritdoc} */ - protected function setUp() + protected function setUp(): void { - parent::setUp(); - $this->api = $this->getApiMock(); $this->api->expects($this->once()) ->method('get') diff --git a/test/Github/Tests/Api/Repository/AssetsTest.php b/test/Github/Tests/Api/Repository/AssetsTest.php index 9341cb5ac99..029c10a380f 100644 --- a/test/Github/Tests/Api/Repository/AssetsTest.php +++ b/test/Github/Tests/Api/Repository/AssetsTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Repository; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class AssetsTest extends TestCase @@ -86,10 +87,10 @@ public function shouldEditReleaseAsset() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotEditReleaseAssetWithoutName() { + $this->expectException(MissingArgumentException::class); $assetId = 5; $data = ['not_a_name' => 'just a value']; diff --git a/test/Github/Tests/Api/Repository/ChecksTest.php b/test/Github/Tests/Api/Repository/ChecksTest.php index 23eb545141a..dcc0883d8d7 100644 --- a/test/Github/Tests/Api/Repository/ChecksTest.php +++ b/test/Github/Tests/Api/Repository/ChecksTest.php @@ -2,16 +2,17 @@ namespace Github\Tests\Api\Repository; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class ChecksTest extends TestCase { /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateWithoutHeadSha() { + $this->expectException(MissingArgumentException::class); $data = ['name' => 'my check']; $api = $this->getApiMock(); @@ -23,10 +24,10 @@ public function shouldNotCreateWithoutHeadSha() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateWithoutName() { + $this->expectException(MissingArgumentException::class); $data = ['head_sha' => 'commitSHA123456']; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Repository/CommentsTest.php b/test/Github/Tests/Api/Repository/CommentsTest.php index b573d3735c3..949bf4e231d 100644 --- a/test/Github/Tests/Api/Repository/CommentsTest.php +++ b/test/Github/Tests/Api/Repository/CommentsTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Repository; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class CommentsTest extends TestCase @@ -56,10 +57,10 @@ public function shouldShowComment() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateWithoutBody() { + $this->expectException(MissingArgumentException::class); $data = ['line' => 53, 'path' => 'test.php', 'position' => 2]; $api = $this->getApiMock(); @@ -105,10 +106,10 @@ public function shouldCreateRepositoryCommitCommentWithoutLine() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotUpdateWithoutBody() { + $this->expectException(MissingArgumentException::class); $api = $this->getApiMock(); $api->expects($this->never()) ->method('patch'); diff --git a/test/Github/Tests/Api/Repository/ContentsTest.php b/test/Github/Tests/Api/Repository/ContentsTest.php index 12fa01d44ef..122fbf5cdf9 100644 --- a/test/Github/Tests/Api/Repository/ContentsTest.php +++ b/test/Github/Tests/Api/Repository/ContentsTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Repository; +use Github\Exception\MissingArgumentException; use Github\Exception\TwoFactorAuthenticationRequiredException; use Github\Tests\Api\TestCase; use GuzzleHttp\Psr7\Response; @@ -85,10 +86,10 @@ public function shouldReturnFalseWhenFileIsNotFound($failureStub) /** * @test - * @expectedException \Github\Exception\TwoFactorAuthenticationRequiredException */ public function shouldBubbleTwoFactorAuthenticationRequiredExceptionsWhenCheckingFileRequiringAuth() { + $this->expectException(TwoFactorAuthenticationRequiredException::class); $api = $this->getApiMock(); $api->expects($this->once()) ->method('head') @@ -126,11 +127,11 @@ public function shouldCreateNewFile() /** * @test - * @expectedException \Github\Exception\MissingArgumentException - * @expectedExceptionMessage One or more of required ("name", "email") parameters is missing! */ public function shouldThrowExceptionWhenCreateNewFileWithInvalidCommitter() { + $this->expectException(MissingArgumentException::class); + $this->expectExceptionMessage('One or more of required ("name", "email") parameters is missing!'); $committer = ['invalid_key' => 'some data']; $api = $this->getApiMock(); $api->create('KnpLabs', 'php-github-api', 'test/Github/Tests/Api/Repository/ContentsTest.php', 'some content', 'a commit message', null, $committer); @@ -166,11 +167,11 @@ public function shouldUpdateFile() /** * @test - * @expectedException \Github\Exception\MissingArgumentException - * @expectedExceptionMessage One or more of required ("name", "email") parameters is missing! */ public function shouldThrowExceptionWhenUpdateFileWithInvalidCommitter() { + $this->expectException(MissingArgumentException::class); + $this->expectExceptionMessage('One or more of required ("name", "email") parameters is missing!'); $committer = ['invalid_key' => 'some data']; $api = $this->getApiMock(); $api->update('KnpLabs', 'php-github-api', 'test/Github/Tests/Api/Repository/ContentsTest.php', 'some content', 'a commit message', null, null, $committer); @@ -204,11 +205,11 @@ public function shouldDeleteFile() /** * @test - * @expectedException \Github\Exception\MissingArgumentException - * @expectedExceptionMessage One or more of required ("name", "email") parameters is missing! */ public function shouldThrowExceptionWhenDeleteFileWithInvalidCommitter() { + $this->expectException(MissingArgumentException::class); + $this->expectExceptionMessage('One or more of required ("name", "email") parameters is missing!'); $committer = ['invalid_key' => 'some data']; $api = $this->getApiMock(); $api->rm('KnpLabs', 'php-github-api', 'test/Github/Tests/Api/Repository/ContentsTest.php', 'a commit message', null, null, $committer); diff --git a/test/Github/Tests/Api/Repository/DeployKeysTest.php b/test/Github/Tests/Api/Repository/DeployKeysTest.php index 1e1a9ca39c6..2962390bc83 100644 --- a/test/Github/Tests/Api/Repository/DeployKeysTest.php +++ b/test/Github/Tests/Api/Repository/DeployKeysTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Repository; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class DeployKeysTest extends TestCase @@ -56,10 +57,10 @@ public function shouldRemoveDeployKey() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateDeployKeyWithoutName() { + $this->expectException(MissingArgumentException::class); $data = ['config' => 'conf']; $api = $this->getApiMock(); @@ -71,10 +72,10 @@ public function shouldNotCreateDeployKeyWithoutName() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateDeployKeyWithoutColor() { + $this->expectException(MissingArgumentException::class); $data = ['name' => 'test']; $api = $this->getApiMock(); @@ -103,10 +104,10 @@ public function shouldCreateDeployKey() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotUpdateDeployKeyWithoutTitle() { + $this->expectException(MissingArgumentException::class); $data = ['key' => 'ssh-rsa 12323213']; $api = $this->getApiMock(); @@ -120,10 +121,10 @@ public function shouldNotUpdateDeployKeyWithoutTitle() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotUpdateDeployKeyWithoutKey() { + $this->expectException(MissingArgumentException::class); $data = ['title' => 'test']; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Repository/HooksTest.php b/test/Github/Tests/Api/Repository/HooksTest.php index 6571d04496d..6d1a1b7f328 100644 --- a/test/Github/Tests/Api/Repository/HooksTest.php +++ b/test/Github/Tests/Api/Repository/HooksTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Repository; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class HooksTest extends TestCase @@ -56,10 +57,10 @@ public function shouldRemoveHook() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateHookWithoutName() { + $this->expectException(MissingArgumentException::class); $data = ['config' => 'conf']; $api = $this->getApiMock(); @@ -71,10 +72,10 @@ public function shouldNotCreateHookWithoutName() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateHookWithoutColor() { + $this->expectException(MissingArgumentException::class); $data = ['name' => 'test']; $api = $this->getApiMock(); @@ -103,10 +104,10 @@ public function shouldCreateHook() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotUpdateHookWithoutConfig() { + $this->expectException(MissingArgumentException::class); $data = ['name' => 'test']; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Repository/LabelsTest.php b/test/Github/Tests/Api/Repository/LabelsTest.php index df9f03844ec..6373d459e08 100644 --- a/test/Github/Tests/Api/Repository/LabelsTest.php +++ b/test/Github/Tests/Api/Repository/LabelsTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Repository; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class LabelsTest extends TestCase @@ -56,10 +57,10 @@ public function shouldRemoveLabel() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateLabelWithoutName() { + $this->expectException(MissingArgumentException::class); $data = ['color' => 'red']; $api = $this->getApiMock(); @@ -71,10 +72,10 @@ public function shouldNotCreateLabelWithoutName() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateLabelWithoutColor() { + $this->expectException(MissingArgumentException::class); $data = ['name' => 'test']; $api = $this->getApiMock(); @@ -103,10 +104,10 @@ public function shouldCreateLabel() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotUpdateLabelWithoutName() { + $this->expectException(MissingArgumentException::class); $data = ['color' => 'red']; $api = $this->getApiMock(); @@ -118,10 +119,10 @@ public function shouldNotUpdateLabelWithoutName() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotUpdateLabelWithoutColor() { + $this->expectException(MissingArgumentException::class); $data = ['name' => 'test']; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Repository/ProjectsTest.php b/test/Github/Tests/Api/Repository/ProjectsTest.php index 1c0b0f2ce4c..225bda4baf6 100644 --- a/test/Github/Tests/Api/Repository/ProjectsTest.php +++ b/test/Github/Tests/Api/Repository/ProjectsTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Repository; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class ProjectsTest extends TestCase @@ -24,10 +25,10 @@ public function shouldGetAllRepositoryProjects() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateWithoutName() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Repository/ReleasesTest.php b/test/Github/Tests/Api/Repository/ReleasesTest.php index 297ee283a08..8668195c1e6 100644 --- a/test/Github/Tests/Api/Repository/ReleasesTest.php +++ b/test/Github/Tests/Api/Repository/ReleasesTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Repository; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class ReleasesTest extends TestCase @@ -94,10 +95,10 @@ public function shouldCreateRepositoryRelease() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateRepositoryReleaseWithoutTagName() { + $this->expectException(MissingArgumentException::class); $data = ['not_a_tag_name' => '1.1']; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Repository/StatusesTest.php b/test/Github/Tests/Api/Repository/StatusesTest.php index f286d79aa51..e253955f25a 100644 --- a/test/Github/Tests/Api/Repository/StatusesTest.php +++ b/test/Github/Tests/Api/Repository/StatusesTest.php @@ -2,6 +2,7 @@ namespace Github\Tests\Api\Repository; +use Github\Exception\MissingArgumentException; use Github\Tests\Api\TestCase; class StatusesTest extends TestCase @@ -57,10 +58,10 @@ public function shouldShowCombinedCommitStatuses() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ public function shouldNotCreateWithoutStatus() { + $this->expectException(MissingArgumentException::class); $data = []; $api = $this->getApiMock(); diff --git a/test/Github/Tests/Api/Repository/TrafficTest.php b/test/Github/Tests/Api/Repository/TrafficTest.php index f13a71ace1b..b6136cebe86 100644 --- a/test/Github/Tests/Api/Repository/TrafficTest.php +++ b/test/Github/Tests/Api/Repository/TrafficTest.php @@ -1,5 +1,7 @@ expectException(InvalidArgumentException::class); $client = new Client(); $client->authenticate('login', null, null); @@ -145,20 +146,20 @@ public function shouldGetMagicApiInstance($apiName, $class) /** * @test - * @expectedException \Github\Exception\InvalidArgumentException */ public function shouldNotGetApiInstance() { + $this->expectException(InvalidArgumentException::class); $client = new Client(); $client->api('do_not_exist'); } /** * @test - * @expectedException BadMethodCallException */ public function shouldNotGetMagicApiInstance() { + $this->expectException(BadMethodCallException::class); $client = new Client(); $client->doNotExist(); } diff --git a/test/Github/Tests/HttpClient/PathPrependTest.php b/test/Github/Tests/HttpClient/Plugin/PathPrependTest.php similarity index 100% rename from test/Github/Tests/HttpClient/PathPrependTest.php rename to test/Github/Tests/HttpClient/Plugin/PathPrependTest.php diff --git a/test/Github/Tests/Integration/GistTest.php b/test/Github/Tests/Integration/GistTest.php index e8ce7bc2543..deb079f57e6 100644 --- a/test/Github/Tests/Integration/GistTest.php +++ b/test/Github/Tests/Integration/GistTest.php @@ -2,6 +2,8 @@ namespace Github\Tests\Integration; +use Github\Exception\RuntimeException; + /** * @group integration */ @@ -25,10 +27,10 @@ public function shouldRetrievePublicGistsListWhenCalledAnonymously() /** * @test - * @expectedException \Github\Exception\RuntimeException */ public function shouldNotGetStarredListWithoutAuthorization() { + $this->expectException(RuntimeException::class); $this->client->api('gists')->all('starred'); } diff --git a/test/Github/Tests/Integration/RateLimitTest.php b/test/Github/Tests/Integration/RateLimitTest.php index c4b5a521645..b003e5b0604 100644 --- a/test/Github/Tests/Integration/RateLimitTest.php +++ b/test/Github/Tests/Integration/RateLimitTest.php @@ -17,7 +17,8 @@ public function shouldRetrievedRateLimits() $response = $this->client->api('rate_limit')->getRateLimits(); $this->assertArrayHasKey('resources', $response); - $this->assertArraySubset(['resources' => ['core' => ['limit' => 60]]], $response); + $this->assertArrayHasKey('resources', $response); + $this->assertSame(['core' => ['limit' => 60]], $response['resources']); } /** @@ -27,7 +28,7 @@ public function shouldRetrieveRateLimitsAndReturnLimitInstances() { $response = $this->client->api('rate_limit')->getLimits(); - $this->assertInternalType('array', $response); + $this->assertIsArray($response); $this->assertContainsOnlyInstancesOf(RateLimitResource::class, $response); $this->assertEquals(60, $response->getLimit('core')->getLimit()); } diff --git a/test/Github/Tests/Integration/RepoTest.php b/test/Github/Tests/Integration/RepoTest.php index 076175f2523..2d958e35713 100644 --- a/test/Github/Tests/Integration/RepoTest.php +++ b/test/Github/Tests/Integration/RepoTest.php @@ -21,7 +21,7 @@ public function shouldShowPRDiffIfHeaderIsPresent() $diff = $this->client->api('pull_request')->show('KnpLabs', 'php-github-api', '92'); - $this->assertInternalType('string', $diff); + $this->assertIsString($diff); } /** @@ -38,7 +38,7 @@ public function shouldRetrieveRawBlob() 'e50d5e946385cff052636e2f09f36b03d1c368f4' ); - $this->assertInternalType('string', $contents); + $this->assertIsString($contents); $this->assertStringStartsWith('assertInternalType('string', $contents); + $this->assertIsString($contents); $this->assertStringStartsWith('{', $contents); } diff --git a/test/Github/Tests/Integration/TestCase.php b/test/Github/Tests/Integration/TestCase.php index 6f8e5815719..319070d5014 100644 --- a/test/Github/Tests/Integration/TestCase.php +++ b/test/Github/Tests/Integration/TestCase.php @@ -16,7 +16,7 @@ class TestCase extends \PHPUnit\Framework\TestCase */ protected $client; - public function setUp() + public function setUp(): void { // You have to specify authentication here to run full suite $client = new Client(); diff --git a/test/Github/Tests/Integration/UserTest.php b/test/Github/Tests/Integration/UserTest.php index d08f1d643a2..57dbeceeefc 100644 --- a/test/Github/Tests/Integration/UserTest.php +++ b/test/Github/Tests/Integration/UserTest.php @@ -2,6 +2,8 @@ namespace Github\Tests\Integration; +use Github\Exception\RuntimeException; + /** * @group integration */ @@ -32,10 +34,10 @@ public function shouldShowUserData() /** * @test - * @expectedException \Github\Exception\RuntimeException */ public function shouldNotUpdateUserWithoutAuthorization() { + $this->expectException(RuntimeException::class); $this->client->api('current_user')->update(['email' => 'leszek.prabucki@gmail.com']); } @@ -69,19 +71,19 @@ public function shouldGetFollowersUsers() /** * @test - * @expectedException \Github\Exception\RuntimeException */ public function shouldNotFollowUserWithoutAuthorization() { + $this->expectException(RuntimeException::class); $this->client->api('current_user')->follow()->follow('KnpLabs'); } /** * @test - * @expectedException \Github\Exception\RuntimeException */ public function shouldNotUnfollowUserWithoutAuthorization() { + $this->expectException(RuntimeException::class); $this->client->api('current_user')->follow()->unfollow('KnpLabs'); }