Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit dd0af98

Browse files
committed
🚿
1 parent acb7af9 commit dd0af98

6 files changed

+13
-16
lines changed

src/Storage/OAuthStorageAbstract.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
abstract class OAuthStorageAbstract implements OAuthStorageInterface, LoggerAwareInterface{
2424
use LoggerAwareTrait;
2525

26-
protected const TOKEN_NONCE = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01";
27-
2826
/**
2927
* @var \chillerlan\OAuth\OAuthOptions
3028
*/

src/Storage/OAuthStorageInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
interface OAuthStorageInterface{
1818

19+
public const TOKEN_NONCE = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01";
20+
1921
/**
2022
* @param string $service
2123
* @param \chillerlan\OAuth\Core\AccessToken $token

tests/Core/APITestAbstract.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,8 @@ public function __construct(ContainerInterface $options){
120120
$this->client = new TinyCurlClient($this->options, new Request($this->options));
121121
}
122122

123-
public function request(string $url, array $params = null, string $method = null, $body = null, array $headers = null):HTTPResponseInterface{
124-
$args = func_get_args();
125-
$response = $this->client->request(...$args);
123+
protected function getResponse():HTTPResponseInterface{
124+
$response = $this->client->request($this->requestURL, $this->requestParams, $this->requestMethod, $this->requestBody, $this->requestHeaders);
126125
usleep($this->options->sleep * 1000000);
127126
return $response;
128127
}

tests/Core/OAuth1Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ protected function setUp(){
4242

4343
protected function initHttp():HTTPClientInterface{
4444
return new class(new OAuthOptions) extends HTTPClientAbstract{
45-
public function request(string $url, array $params = null, string $method = null, $body = null, array $headers = null):HTTPResponseInterface{
46-
return new HTTPResponse(['body' => OAuth1Test::OAUTH1_RESPONSES[$url]]);
45+
protected function getResponse():HTTPResponseInterface{
46+
return new HTTPResponse(['body' => OAuth1Test::OAUTH1_RESPONSES[$this->requestURL]]);
4747
}
4848
};
4949
}

tests/Core/OAuth2Test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
HTTPClientAbstract, HTTPClientInterface, HTTPResponse, HTTPResponseInterface
1717
};
1818
use chillerlan\OAuth\{
19-
Core\AccessToken, Core\ClientCredentials, Core\TokenRefresh, OAuthOptions
19+
Core\AccessToken, Core\ClientCredentials, Core\CSRFToken, Core\TokenRefresh, OAuthOptions
2020
};
2121

2222
/**
@@ -59,16 +59,16 @@ protected function setUp(){
5959
$this->setProperty($this->provider, 'clientCredentialsTokenURL', 'https://localhost/oauth2/client_credentials');
6060
}
6161

62-
if($this->provider instanceof \chillerlan\OAuth\Core\CSRFToken){
62+
if($this->provider instanceof CSRFToken){
6363
$this->storage->storeCSRFState($this->provider->serviceName, 'test_state');
6464
}
6565

6666
}
6767

6868
protected function initHttp():HTTPClientInterface{
6969
return new class(new OAuthOptions) extends HTTPClientAbstract{
70-
public function request(string $url, array $params = null, string $method = null, $body = null, array $headers = null):HTTPResponseInterface{
71-
return new HTTPResponse(['body' => json_encode(OAuth2Test::OAUTH2_RESPONSES[$url])]);
70+
protected function getResponse():HTTPResponseInterface{
71+
return new HTTPResponse(['body' => json_encode(OAuth2Test::OAUTH2_RESPONSES[$this->requestURL])]);
7272
}
7373
};
7474
}

tests/Core/ProviderTestAbstract.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414

1515
use chillerlan\HTTP\HTTPClientInterface;
1616
use chillerlan\OAuth\{
17-
Core\AccessToken, OAuthOptions, Storage\MemoryStorage, Storage\OAuthStorageInterface
17+
Core\AccessToken, Core\OAuthInterface, OAuthOptions, Storage\MemoryStorage, Storage\OAuthStorageInterface
1818
};
1919
use PHPUnit\Framework\TestCase;
20-
use ReflectionClass;
21-
use ReflectionMethod;
22-
use ReflectionProperty;
20+
use ReflectionClass, ReflectionMethod, ReflectionProperty;
2321

2422
abstract class ProviderTestAbstract extends TestCase{
2523

@@ -119,7 +117,7 @@ protected function storeToken(AccessToken $token){
119117
}
120118

121119
public function testInstance(){
122-
$this->assertInstanceOf(\chillerlan\OAuth\Core\OAuthInterface::class, $this->provider);
120+
$this->assertInstanceOf(OAuthInterface::class, $this->provider);
123121
}
124122

125123
public function testMagicGetServicename(){

0 commit comments

Comments
 (0)