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

Commit c72d394

Browse files
committed
🛀 test cleanup
1 parent 54a9220 commit c72d394

File tree

80 files changed

+256
-247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+256
-247
lines changed

tests/Amazon/AmazonAPITest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@
1313
namespace chillerlan\OAuthTest\Providers\Amazon;
1414

1515
use chillerlan\OAuth\Providers\Amazon\Amazon;
16-
use chillerlan\OAuthTest\API\OAuth2APITestAbstract;
16+
use chillerlan\OAuthTest\Providers\OAuth2APITest;
1717

1818
/**
1919
* Amazon API usage tests/examples
2020
*
2121
* @property \chillerlan\OAuth\Providers\Amazon\Amazon $provider
2222
*/
23-
class AmazonAPITest extends OAuth2APITestAbstract{
23+
class AmazonAPITest extends OAuth2APITest{
2424

25-
protected $CFG = __DIR__.'/../../config';
2625
protected $FQN = Amazon::class;
2726
protected $ENV = 'AMAZON';
2827

tests/Amazon/AmazonTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
namespace chillerlan\OAuthTest\Providers\Amazon;
1414

1515
use chillerlan\OAuth\Providers\Amazon\Amazon;
16-
use chillerlan\OAuthTest\Providers\OAuth2ProviderTestAbstract;
16+
use chillerlan\OAuthTest\Providers\OAuth2ProviderTest;
1717

1818
/**
1919
* @property \chillerlan\OAuth\Providers\Amazon\Amazon $provider
2020
*/
21-
class AmazonTest extends OAuth2ProviderTestAbstract{
21+
class AmazonTest extends OAuth2ProviderTest{
2222

2323
protected $FQN = Amazon::class;
2424

tests/BigCartel/BigCartelAPITest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
namespace chillerlan\OAuthTest\Providers\BigCartel;
1414

1515
use chillerlan\OAuth\Providers\BigCartel\BigCartel;
16-
use chillerlan\OAuthTest\API\OAuth2APITestAbstract;
16+
use chillerlan\OAuthTest\Providers\OAuth2APITest;
1717

1818
/**
1919
* @property \chillerlan\OAuth\Providers\BigCartel\BigCartel $provider
2020
*/
21-
class BigCartelAPITest extends OAuth2APITestAbstract{
21+
class BigCartelAPITest extends OAuth2APITest{
2222

23-
protected $CFG = __DIR__.'/../../config';
2423
protected $FQN = BigCartel::class;
2524
protected $ENV = 'BIGCARTEL';
2625

tests/BigCartel/BigCartelTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
namespace chillerlan\OAuthTest\Providers\BigCartel;
1414

1515
use chillerlan\OAuth\Providers\BigCartel\BigCartel;
16-
use chillerlan\OAuthTest\Providers\OAuth2ProviderTestAbstract;
16+
use chillerlan\OAuthTest\Providers\OAuth2ProviderTest;
1717

1818
/**
1919
* @property \chillerlan\OAuth\Providers\BigCartel\BigCartel $provider
2020
*/
21-
class BigCartelTest extends OAuth2ProviderTestAbstract{
21+
class BigCartelTest extends OAuth2ProviderTest{
2222

2323
protected $FQN = BigCartel::class;
2424

tests/Bitbucket/BitbucketAPITest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
namespace chillerlan\OAuthTest\Providers\Bitbucket;
1414

1515
use chillerlan\OAuth\Providers\Bitbucket\Bitbucket;
16-
use chillerlan\OAuthTest\API\OAuth2APITestAbstract;
16+
use chillerlan\OAuthTest\Providers\OAuth2APITest;
1717

1818
/**
19+
* @property \chillerlan\OAuth\Providers\Bitbucket\Bitbucket $provider
1920
*/
20-
class BitbucketAPITest extends OAuth2APITestAbstract{
21+
class BitbucketAPITest extends OAuth2APITest{
2122

22-
protected $CFG = __DIR__.'/../../config';
2323
protected $FQN = Bitbucket::class;
2424
protected $ENV = 'BITBUCKET';
2525

tests/Bitbucket/BitbucketTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
namespace chillerlan\OAuthTest\Providers\Bitbucket;
1414

1515
use chillerlan\OAuth\Providers\Bitbucket\Bitbucket;
16-
use chillerlan\OAuthTest\Providers\OAuth2ProviderTestAbstract;
16+
use chillerlan\OAuthTest\Providers\OAuth2ProviderTest;
1717

1818
/**
1919
* @property \chillerlan\OAuth\Providers\Bitbucket\Bitbucket $provider
2020
*/
21-
class BitbucketTest extends OAuth2ProviderTestAbstract{
21+
class BitbucketTest extends OAuth2ProviderTest{
2222

2323
protected $FQN = Bitbucket::class;
2424

tests/Deezer/DeezerAPITest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
namespace chillerlan\OAuthTest\Providers;
1414

1515
use chillerlan\OAuth\Providers\Deezer\Deezer;
16-
use chillerlan\OAuthTest\API\OAuth2APITestAbstract;
1716

1817
/**
1918
* Spotify API usage tests/examples
@@ -22,9 +21,8 @@
2221
*
2322
* @property \chillerlan\OAuth\Providers\Deezer\Deezer $provider
2423
*/
25-
class DeezerAPITest extends OAuth2APITestAbstract{
24+
class DeezerAPITest extends OAuth2APITest{
2625

27-
protected $CFG = __DIR__.'/../../config';
2826
protected $FQN = Deezer::class;
2927
protected $ENV = 'DEEZER';
3028

tests/Deezer/DeezerTest.php

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,8 @@ class DeezerTest extends OAuth2ProviderTestAbstract{
2626

2727
protected $FQN = Deezer::class;
2828

29-
protected $responses = [
30-
'/oauth2/access_token' => [
31-
'access_token' => 'test_access_token',
32-
'expires' => 3600,
33-
'state' => 'test_state',
34-
],
35-
'/oauth2/refresh_token' => [
36-
'access_token' => 'test_refreshed_access_token',
37-
'expires' => 60,
38-
'state' => 'test_state',
39-
],
40-
'/oauth2/client_credentials' => [
41-
'access_token' => 'test_client_credentials_token',
42-
'expires' => 30,
43-
'state' => 'test_state',
44-
],
45-
'/oauth2/api/request' => [
46-
'data' => 'such data! much wow!'
47-
],
48-
'/oauth2/api/request/test/get' => ['foo'],
49-
];
50-
5129
protected function initHttp():ClientInterface{
52-
return new class($this->reflection, $this->responses) implements ClientInterface{
53-
54-
/** @var \ReflectionClass */
55-
protected $reflection;
56-
/** @var array */
57-
protected $responses;
58-
59-
public function __construct(ReflectionClass $reflection, array $responses){
60-
$this->reflection = $reflection;
61-
$this->responses = $responses;
62-
}
30+
return new class($this->responses, $this->logger) extends ProviderTestHttpClient{
6331

6432
public function sendRequest(RequestInterface $request):ResponseInterface{
6533
$path = $request->getUri()->getPath();
@@ -69,8 +37,9 @@ public function sendRequest(RequestInterface $request):ResponseInterface{
6937
? json_encode($body)
7038
: http_build_query($body);
7139

72-
return (new Response)->withBody(Psr17\create_stream_from_input($body));
40+
return $this->logRequest($request, (new Response)->withBody(Psr17\create_stream_from_input($body)));
7341
}
42+
7443
};
7544
}
7645

tests/DeviantArt/DeviantArtAPITest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
namespace chillerlan\OAuthTest\Providers\DeviantArt;
1414

1515
use chillerlan\OAuth\Providers\DeviantArt\DeviantArt;
16-
use chillerlan\OAuthTest\API\OAuth2APITestAbstract;
16+
use chillerlan\OAuthTest\Providers\OAuth2APITest;
1717

1818
/**
1919
* @property \chillerlan\OAuth\Providers\DeviantArt\DeviantArt $provider
2020
*/
21-
class DeviantArtAPITest extends OAuth2APITestAbstract{
21+
class DeviantArtAPITest extends OAuth2APITest{
2222

23-
protected $CFG = __DIR__.'/../../config';
2423
protected $FQN = DeviantArt::class;
2524
protected $ENV = 'DEVIANTART';
2625

tests/DeviantArt/DeviantArtTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
namespace chillerlan\OAuthTest\Providers\DeviantArt;
1414

1515
use chillerlan\OAuth\Providers\DeviantArt\DeviantArt;
16-
use chillerlan\OAuthTest\Providers\OAuth2ProviderTestAbstract;
16+
use chillerlan\OAuthTest\Providers\OAuth2ProviderTest;
1717

1818
/**
1919
* @property \chillerlan\OAuth\Providers\DeviantArt\DeviantArt $provider
2020
*/
21-
class DeviantArtTest extends OAuth2ProviderTestAbstract{
21+
class DeviantArtTest extends OAuth2ProviderTest{
2222

2323
protected $FQN = DeviantArt::class;
2424

0 commit comments

Comments
 (0)