forked from salesforce-marketingcloud/FuelSDK-PHP
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refresh token public and web app support (salesforce-marketingcloud#150)
* initial checkin * Adding unit tests * updating version and readme * address code review concerns * address code review concerns * adding the context variable back
- Loading branch information
1 parent
ad7416e
commit 27895de
Showing
6 changed files
with
170 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
namespace FuelSdk\Test; | ||
use FuelSdk\ET_Client; | ||
use FuelSdk\ET_Asset; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class OAuth2Test extends TestCase | ||
{ | ||
private $client; | ||
|
||
function __construct() | ||
{ | ||
$this->client = new ET_Client(true); | ||
} | ||
|
||
public function testIfAuthTokenAndRefreshTokenDifferIfRefreshTokenIsEnforced() | ||
{ | ||
$reflection = new \ReflectionClass(get_class($this->client)); | ||
$clientid = $reflection->getProperty("clientId"); | ||
$clientid->setAccessible(true); | ||
$token = $this->client->getAuthToken(); | ||
$refreshToken = $this->client->getRefreshToken(null); | ||
$this->client->refreshTokenWithOAuth2(true); | ||
|
||
$newtoken = $this->client->getAuthToken(); | ||
$newrefreshToken = $this->client->getRefreshToken(null); | ||
|
||
$this->assertTrue($refreshToken != $newrefreshToken && $token != $newtoken); | ||
} | ||
} | ||
?> |