This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/tests/PayPal/Test/Auth/OAuthTokenCredentialTest.php
japatel 61a52e4623 Enabled EC Parameters support
- Updated Api to enabled EC Parameters
- Updated Tests
- Updated Logging Manager
- Added a feature to do validation on accessors.
2014-10-10 10:50:49 -05:00

38 lines
1.2 KiB
PHP

<?php
// namespace PayPal\Test\Common;
use PayPal\Auth\OAuthTokenCredential;
use PayPal\Test\Constants;
use PayPal\Core\PPConfigManager;
use PayPal\Exception\PPConnectionException;
class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase
{
/**
* @group integration
*/
public function testGetAccessToken()
{
$cred = new OAuthTokenCredential(Constants::CLIENT_ID, Constants::CLIENT_SECRET);
$config = PPConfigManager::getInstance()->getConfigHashmap();
$token = $cred->getAccessToken($config);
$this->assertNotNull($token);
// Check that we get the same token when issuing a new call before token expiry
$newToken = $cred->getAccessToken($config);
$this->assertNotNull($newToken);
$this->assertEquals($token, $newToken);
}
/**
* @group integration
*/
public function testInvalidCredentials()
{
$this->setExpectedException('PayPal\Exception\PPConnectionException');
$cred = new OAuthTokenCredential('dummy', 'secret');
$this->assertNull($cred->getAccessToken(PPConfigManager::getInstance()->getConfigHashmap()));
}
}