From 7898663172d54d06a6a1b3f785db6916569d28a2 Mon Sep 17 00:00:00 2001 From: GordonSchmidt Date: Mon, 8 Apr 2013 13:55:18 +0300 Subject: [PATCH 1/4] Missing autheticate method in HttpClientInterface --- lib/Github/HttpClient/HttpClientInterface.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Github/HttpClient/HttpClientInterface.php b/lib/Github/HttpClient/HttpClientInterface.php index 7c327d625e3..f84472ee7d6 100644 --- a/lib/Github/HttpClient/HttpClientInterface.php +++ b/lib/Github/HttpClient/HttpClientInterface.php @@ -95,4 +95,15 @@ public function setOption($name, $value); * @param array $headers */ public function setHeaders(array $headers); + + /** + * Authenticate a user for all next requests + * + * @param string $tokenOrLogin GitHub private token/username/client ID + * @param null|string $password GitHub password/secret (optionally can contain $authMethod) + * @param null|string $authMethod One of the AUTH_* class constants + * + * @throws InvalidArgumentException If no authentication method was given + */ + public function authenticate($tokenOrLogin, $password, $authMethod); } From f491c28e8b4fc9719354010ee54c9496113343af Mon Sep 17 00:00:00 2001 From: GordonSchmidt Date: Mon, 8 Apr 2013 14:09:14 +0300 Subject: [PATCH 2/4] Update TestHttpClient for changes in interface --- test/Github/Tests/Mock/TestHttpClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Github/Tests/Mock/TestHttpClient.php b/test/Github/Tests/Mock/TestHttpClient.php index 0423d8ab11d..7bef80defb7 100644 --- a/test/Github/Tests/Mock/TestHttpClient.php +++ b/test/Github/Tests/Mock/TestHttpClient.php @@ -18,7 +18,7 @@ class TestHttpClient implements HttpClientInterface public $options = array(); public $headers = array(); - public function authenticate() + public function authenticate($tokenOrLogin, $password, $authMethod) { $this->authenticated = true; } From a5948012744ece6020abf2cdb90289309f0ac49e Mon Sep 17 00:00:00 2001 From: GordonSchmidt Date: Mon, 8 Apr 2013 14:18:54 +0300 Subject: [PATCH 3/4] Update ClientTest for changes in interface --- test/Github/Tests/ClientTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Github/Tests/ClientTest.php b/test/Github/Tests/ClientTest.php index 0469b887697..08984fa882b 100644 --- a/test/Github/Tests/ClientTest.php +++ b/test/Github/Tests/ClientTest.php @@ -171,7 +171,7 @@ public function getApiClassesProvider() public function getHttpClientMock(array $methods = array()) { $methods = array_merge( - array('get', 'post', 'patch', 'put', 'delete', 'request', 'setOption', 'setHeaders'), + array('get', 'post', 'patch', 'put', 'delete', 'request', 'setOption', 'setHeaders', 'authenticate'), $methods ); From f0cc9b758ac336d25fb8f531184ce45d94e39f19 Mon Sep 17 00:00:00 2001 From: GordonSchmidt Date: Mon, 8 Apr 2013 14:24:00 +0300 Subject: [PATCH 4/4] Update ClientTest for changes in interface --- test/Github/Tests/ClientTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Github/Tests/ClientTest.php b/test/Github/Tests/ClientTest.php index 08984fa882b..d425f8d60fd 100644 --- a/test/Github/Tests/ClientTest.php +++ b/test/Github/Tests/ClientTest.php @@ -33,7 +33,7 @@ public function shouldPassHttpClientInterfaceToConstructor() */ public function shouldAuthenticateUsingAllGivenParameters($login, $password, $method) { - $httpClient = $this->getHttpClientMock(array('authenticate')); + $httpClient = $this->getHttpClientMock(); $httpClient->expects($this->once()) ->method('authenticate') ->with($login, $password, $method); @@ -58,7 +58,7 @@ public function getAuthenticationFullData() */ public function shouldAuthenticateUsingGivenParameters($token, $method) { - $httpClient = $this->getHttpClientMock(array('authenticate')); + $httpClient = $this->getHttpClientMock(); $httpClient->expects($this->once()) ->method('authenticate') ->with($token, null, $method);