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

Commit

Permalink
🚿 store token per test (messes with live tests otherwise)
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Jul 28, 2023
1 parent 6d6db5c commit fded068
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
8 changes: 5 additions & 3 deletions tests/Providers/OAuth1ProviderTestAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ abstract class OAuth1ProviderTestAbstract extends OAuthProviderTestAbstract{
'{"data":"such data! much wow!"}',
];

# protected function setUp():void{
# parent::setUp();
# }
protected function setUp():void{
parent::setUp();

$this->provider->storeAccessToken(new AccessToken(['accessToken' => 'foo']));
}

public function testOAuth1Instance():void{
$this::assertInstanceOf(OAuth1Interface::class, $this->provider);
Expand Down
1 change: 1 addition & 0 deletions tests/Providers/OAuth2ProviderTestAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ abstract class OAuth2ProviderTestAbstract extends OAuthProviderTestAbstract{
protected function setUp():void{
parent::setUp();

$this->provider->storeAccessToken(new AccessToken(['accessToken' => 'foo']));
$this->storage->storeCSRFState('test_state', $this->provider->serviceName);
}

Expand Down
1 change: 0 additions & 1 deletion tests/Providers/OAuthProviderTestAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ protected function setUp():void{
$this->reflection->getProperty($property)->setValue($this->provider, $value);
}

$this->provider->storeAccessToken(new AccessToken(['accessToken' => 'foo']));
}

protected function initFactories():void{
Expand Down
7 changes: 7 additions & 0 deletions tests/Providers/RequestTest/OAuthProviderRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace chillerlan\OAuthTest\Providers\RequestTest;

use chillerlan\OAuth\Core\AccessToken;
use chillerlan\OAuth\Core\ProviderException;
use chillerlan\OAuthTest\Providers\{OAuthProviderTestAbstract, ProviderTestHttpClient};

Expand All @@ -21,6 +22,12 @@ final class OAuthProviderRequestTest extends OAuthProviderTestAbstract{
'/api/gimme' => 'much data',
];

protected function setUp():void{
parent::setUp();

$this->provider->storeAccessToken(new AccessToken(['accessToken' => 'foo']));
}

public function testRequestURI():void{
// just the path segment
$r = $this->provider->request('/api/gimme');
Expand Down

0 comments on commit fded068

Please sign in to comment.