{"action":"created","comment":{"url":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/comments/32173835","id":32173835,"diff_hunk":"@@ -472,4 +414,85 @@ public function testAuthenticatedRequestAndResponse()\n         $result = $provider->getResponse($request);\n         $this->assertSame(['example' => 'response'], $result);\n     }\n+\n+    private function accessTokenTest($method)\n+    {\n+        $provider = new MockProvider([\n+          'clientId' => 'mock_client_id',\n+          'clientSecret' => 'mock_secret',\n+          'redirectUri' => 'none',\n+        ]);\n+\n+        $provider->setAccessTokenMethod($method);\n+\n+        $grant_name = 'mock';\n+        $raw_response = ['access_token' => 'okay', 'expires' => time() + 3600, 'uid' => 3];\n+        $token = new AccessToken($raw_response);\n+\n+        $contains_correct_grant_type = function ($params) use ($grant_name) {\n+            return is_array($params) && $params['grant_type'] === $grant_name;\n+        };\n+\n+        $grant = m::mock('League\\OAuth2\\Client\\Grant\\GrantInterface');\n+        $grant->shouldReceive('__toString')\n+              ->times(1)\n+              ->andReturn($grant_name);\n+        $grant->shouldReceive('prepRequestParams')\n+              ->with(\n+                  m::on($contains_correct_grant_type),\n+                  m::type('array')\n+              )\n+              ->andReturn([]);\n+        $grant->shouldReceive('handleResponse')\n+              ->with($raw_response)\n+              ->andReturn($token);\n+\n+        $stream = m::mock('Psr\\Http\\Message\\StreamInterface');\n+        $stream->shouldReceive('__toString')->times(1)->andReturn(\n+            json_encode($raw_response)\n+        );\n+\n+        $response = m::mock('Psr\\Http\\Message\\ResponseInterface');\n+        $response->shouldReceive('getBody')->times(1)->andReturn($stream);\n+\n+        $url = $provider->urlAccessToken();\n+\n+        $client = m::mock('GuzzleHttp\\ClientInterface');\n+        $client->shouldReceive('send')->with(\n+            m::on(function ($request) use ($method, $url) {\n+                return $request->getMethod() === $method\n+                    && (string) $request->getUri() === $url;\n+            })\n+        )->times(1)->andReturn($response);\n+\n+        $provider->setHttpClient($client);\n+\n+        $result = $provider->getAccessToken($grant, ['code' => 'mock_authorization_code']);\n+\n+        $this->assertSame($result, $token);\n+        $this->assertSame($raw_response['uid'], $token->getUid());\n+        $this->assertSame($raw_response['access_token'], $token->getToken());\n+        $this->assertSame($raw_response['expires'], $token->getExpires());\n+    }\n+\n+    public function testGetAccessTokenMethods()\n+    {\n+        $this->accessTokenTest('GET');","path":"test/src/Provider/AbstractProviderTest.php","position":null,"original_position":168,"commit_id":"e722dbacb3845c891ea12e1e5439d14b283d52b2","original_commit_id":"f53feb99b0dc8f9adfceb11e17bd0867e0260d02","user":{"login":"shadowhand","id":38203,"avatar_url":"https://avatars.githubusercontent.com/u/38203?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowhand","html_url":"https://github.com/shadowhand","followers_url":"https://api.github.com/users/shadowhand/followers","following_url":"https://api.github.com/users/shadowhand/following{/other_user}","gists_url":"https://api.github.com/users/shadowhand/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowhand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowhand/subscriptions","organizations_url":"https://api.github.com/users/shadowhand/orgs","repos_url":"https://api.github.com/users/shadowhand/repos","events_url":"https://api.github.com/users/shadowhand/events{/privacy}","received_events_url":"https://api.github.com/users/shadowhand/received_events","type":"User","site_admin":false},"body":"https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers for complete reference.","created_at":"2015-06-10T22:30:47Z","updated_at":"2015-06-10T22:30:47Z","html_url":"https://github.com/shadowhand/oauth2-client/pull/3#discussion_r32173835","pull_request_url":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/comments/32173835"},"html":{"href":"https://github.com/shadowhand/oauth2-client/pull/3#discussion_r32173835"},"pull_request":{"href":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/3","id":37406637,"html_url":"https://github.com/shadowhand/oauth2-client/pull/3","diff_url":"https://github.com/shadowhand/oauth2-client/pull/3.diff","patch_url":"https://github.com/shadowhand/oauth2-client/pull/3.patch","issue_url":"https://api.github.com/repos/shadowhand/oauth2-client/issues/3","number":3,"state":"open","locked":false,"title":"Improved test coverage, removed access token method const","user":{"login":"rtheunissen","id":809191,"avatar_url":"https://avatars.githubusercontent.com/u/809191?v=3","gravatar_id":"","url":"https://api.github.com/users/rtheunissen","html_url":"https://github.com/rtheunissen","followers_url":"https://api.github.com/users/rtheunissen/followers","following_url":"https://api.github.com/users/rtheunissen/following{/other_user}","gists_url":"https://api.github.com/users/rtheunissen/gists{/gist_id}","starred_url":"https://api.github.com/users/rtheunissen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtheunissen/subscriptions","organizations_url":"https://api.github.com/users/rtheunissen/orgs","repos_url":"https://api.github.com/users/rtheunissen/repos","events_url":"https://api.github.com/users/rtheunissen/events{/privacy}","received_events_url":"https://api.github.com/users/rtheunissen/received_events","type":"User","site_admin":false},"body":"This pull request achieves the following:\r\n\r\n - Improved test coverage\r\n - Ability to test arbitrary access token request methods\r\n ","created_at":"2015-06-10T21:28:29Z","updated_at":"2015-06-10T22:30:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"693be3e3b49d163863371a4cf90e3c9342c144f5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/3/commits","review_comments_url":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/3/comments","review_comment_url":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shadowhand/oauth2-client/issues/3/comments","statuses_url":"https://api.github.com/repos/shadowhand/oauth2-client/statuses/e722dbacb3845c891ea12e1e5439d14b283d52b2","head":{"label":"rtheunissen:feature/guzzle-6-http","ref":"feature/guzzle-6-http","sha":"e722dbacb3845c891ea12e1e5439d14b283d52b2","user":{"login":"rtheunissen","id":809191,"avatar_url":"https://avatars.githubusercontent.com/u/809191?v=3","gravatar_id":"","url":"https://api.github.com/users/rtheunissen","html_url":"https://github.com/rtheunissen","followers_url":"https://api.github.com/users/rtheunissen/followers","following_url":"https://api.github.com/users/rtheunissen/following{/other_user}","gists_url":"https://api.github.com/users/rtheunissen/gists{/gist_id}","starred_url":"https://api.github.com/users/rtheunissen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtheunissen/subscriptions","organizations_url":"https://api.github.com/users/rtheunissen/orgs","repos_url":"https://api.github.com/users/rtheunissen/repos","events_url":"https://api.github.com/users/rtheunissen/events{/privacy}","received_events_url":"https://api.github.com/users/rtheunissen/received_events","type":"User","site_admin":false},"repo":{"id":36849373,"name":"oauth2-client","full_name":"rtheunissen/oauth2-client","owner":{"login":"rtheunissen","id":809191,"avatar_url":"https://avatars.githubusercontent.com/u/809191?v=3","gravatar_id":"","url":"https://api.github.com/users/rtheunissen","html_url":"https://github.com/rtheunissen","followers_url":"https://api.github.com/users/rtheunissen/followers","following_url":"https://api.github.com/users/rtheunissen/following{/other_user}","gists_url":"https://api.github.com/users/rtheunissen/gists{/gist_id}","starred_url":"https://api.github.com/users/rtheunissen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtheunissen/subscriptions","organizations_url":"https://api.github.com/users/rtheunissen/orgs","repos_url":"https://api.github.com/users/rtheunissen/repos","events_url":"https://api.github.com/users/rtheunissen/events{/privacy}","received_events_url":"https://api.github.com/users/rtheunissen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rtheunissen/oauth2-client","description":"Making it simple to integrate your application with OAuth 2.0 identity providers.","fork":true,"url":"https://api.github.com/repos/rtheunissen/oauth2-client","forks_url":"https://api.github.com/repos/rtheunissen/oauth2-client/forks","keys_url":"https://api.github.com/repos/rtheunissen/oauth2-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rtheunissen/oauth2-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rtheunissen/oauth2-client/teams","hooks_url":"https://api.github.com/repos/rtheunissen/oauth2-client/hooks","issue_events_url":"https://api.github.com/repos/rtheunissen/oauth2-client/issues/events{/number}","events_url":"https://api.github.com/repos/rtheunissen/oauth2-client/events","assignees_url":"https://api.github.com/repos/rtheunissen/oauth2-client/assignees{/user}","branches_url":"https://api.github.com/repos/rtheunissen/oauth2-client/branches{/branch}","tags_url":"https://api.github.com/repos/rtheunissen/oauth2-client/tags","blobs_url":"https://api.github.com/repos/rtheunissen/oauth2-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rtheunissen/oauth2-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rtheunissen/oauth2-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/rtheunissen/oauth2-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rtheunissen/oauth2-client/statuses/{sha}","languages_url":"https://api.github.com/repos/rtheunissen/oauth2-client/languages","stargazers_url":"https://api.github.com/repos/rtheunissen/oauth2-client/stargazers","contributors_url":"https://api.github.com/repos/rtheunissen/oauth2-client/contributors","subscribers_url":"https://api.github.com/repos/rtheunissen/oauth2-client/subscribers","subscription_url":"https://api.github.com/repos/rtheunissen/oauth2-client/subscription","commits_url":"https://api.github.com/repos/rtheunissen/oauth2-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/rtheunissen/oauth2-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/rtheunissen/oauth2-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/rtheunissen/oauth2-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/rtheunissen/oauth2-client/contents/{+path}","compare_url":"https://api.github.com/repos/rtheunissen/oauth2-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rtheunissen/oauth2-client/merges","archive_url":"https://api.github.com/repos/rtheunissen/oauth2-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rtheunissen/oauth2-client/downloads","issues_url":"https://api.github.com/repos/rtheunissen/oauth2-client/issues{/number}","pulls_url":"https://api.github.com/repos/rtheunissen/oauth2-client/pulls{/number}","milestones_url":"https://api.github.com/repos/rtheunissen/oauth2-client/milestones{/number}","notifications_url":"https://api.github.com/repos/rtheunissen/oauth2-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rtheunissen/oauth2-client/labels{/name}","releases_url":"https://api.github.com/repos/rtheunissen/oauth2-client/releases{/id}","created_at":"2015-06-04T05:14:05Z","updated_at":"2015-06-04T05:14:06Z","pushed_at":"2015-06-10T22:30:35Z","git_url":"git://github.com/rtheunissen/oauth2-client.git","ssh_url":"git@github.com:rtheunissen/oauth2-client.git","clone_url":"https://github.com/rtheunissen/oauth2-client.git","svn_url":"https://github.com/rtheunissen/oauth2-client","homepage":"","size":605,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"shadowhand:feature/guzzle-6-http","ref":"feature/guzzle-6-http","sha":"b04e253f9d38d744c6dce46ec3317f4a6c33ae52","user":{"login":"shadowhand","id":38203,"avatar_url":"https://avatars.githubusercontent.com/u/38203?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowhand","html_url":"https://github.com/shadowhand","followers_url":"https://api.github.com/users/shadowhand/followers","following_url":"https://api.github.com/users/shadowhand/following{/other_user}","gists_url":"https://api.github.com/users/shadowhand/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowhand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowhand/subscriptions","organizations_url":"https://api.github.com/users/shadowhand/orgs","repos_url":"https://api.github.com/users/shadowhand/repos","events_url":"https://api.github.com/users/shadowhand/events{/privacy}","received_events_url":"https://api.github.com/users/shadowhand/received_events","type":"User","site_admin":false},"repo":{"id":31221950,"name":"oauth2-client","full_name":"shadowhand/oauth2-client","owner":{"login":"shadowhand","id":38203,"avatar_url":"https://avatars.githubusercontent.com/u/38203?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowhand","html_url":"https://github.com/shadowhand","followers_url":"https://api.github.com/users/shadowhand/followers","following_url":"https://api.github.com/users/shadowhand/following{/other_user}","gists_url":"https://api.github.com/users/shadowhand/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowhand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowhand/subscriptions","organizations_url":"https://api.github.com/users/shadowhand/orgs","repos_url":"https://api.github.com/users/shadowhand/repos","events_url":"https://api.github.com/users/shadowhand/events{/privacy}","received_events_url":"https://api.github.com/users/shadowhand/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shadowhand/oauth2-client","description":"Making it simple to integrate your application with OAuth 2.0 identity providers.","fork":true,"url":"https://api.github.com/repos/shadowhand/oauth2-client","forks_url":"https://api.github.com/repos/shadowhand/oauth2-client/forks","keys_url":"https://api.github.com/repos/shadowhand/oauth2-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shadowhand/oauth2-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shadowhand/oauth2-client/teams","hooks_url":"https://api.github.com/repos/shadowhand/oauth2-client/hooks","issue_events_url":"https://api.github.com/repos/shadowhand/oauth2-client/issues/events{/number}","events_url":"https://api.github.com/repos/shadowhand/oauth2-client/events","assignees_url":"https://api.github.com/repos/shadowhand/oauth2-client/assignees{/user}","branches_url":"https://api.github.com/repos/shadowhand/oauth2-client/branches{/branch}","tags_url":"https://api.github.com/repos/shadowhand/oauth2-client/tags","blobs_url":"https://api.github.com/repos/shadowhand/oauth2-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shadowhand/oauth2-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shadowhand/oauth2-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/shadowhand/oauth2-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shadowhand/oauth2-client/statuses/{sha}","languages_url":"https://api.github.com/repos/shadowhand/oauth2-client/languages","stargazers_url":"https://api.github.com/repos/shadowhand/oauth2-client/stargazers","contributors_url":"https://api.github.com/repos/shadowhand/oauth2-client/contributors","subscribers_url":"https://api.github.com/repos/shadowhand/oauth2-client/subscribers","subscription_url":"https://api.github.com/repos/shadowhand/oauth2-client/subscription","commits_url":"https://api.github.com/repos/shadowhand/oauth2-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/shadowhand/oauth2-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/shadowhand/oauth2-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/shadowhand/oauth2-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/shadowhand/oauth2-client/contents/{+path}","compare_url":"https://api.github.com/repos/shadowhand/oauth2-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shadowhand/oauth2-client/merges","archive_url":"https://api.github.com/repos/shadowhand/oauth2-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shadowhand/oauth2-client/downloads","issues_url":"https://api.github.com/repos/shadowhand/oauth2-client/issues{/number}","pulls_url":"https://api.github.com/repos/shadowhand/oauth2-client/pulls{/number}","milestones_url":"https://api.github.com/repos/shadowhand/oauth2-client/milestones{/number}","notifications_url":"https://api.github.com/repos/shadowhand/oauth2-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shadowhand/oauth2-client/labels{/name}","releases_url":"https://api.github.com/repos/shadowhand/oauth2-client/releases{/id}","created_at":"2015-02-23T18:15:31Z","updated_at":"2015-05-02T03:25:36Z","pushed_at":"2015-06-10T22:30:35Z","git_url":"git://github.com/shadowhand/oauth2-client.git","ssh_url":"git@github.com:shadowhand/oauth2-client.git","clone_url":"https://github.com/shadowhand/oauth2-client.git","svn_url":"https://github.com/shadowhand/oauth2-client","homepage":"","size":831,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/3"},"html":{"href":"https://github.com/shadowhand/oauth2-client/pull/3"},"issue":{"href":"https://api.github.com/repos/shadowhand/oauth2-client/issues/3"},"comments":{"href":"https://api.github.com/repos/shadowhand/oauth2-client/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shadowhand/oauth2-client/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/shadowhand/oauth2-client/statuses/e722dbacb3845c891ea12e1e5439d14b283d52b2"}}}}