Renaming Namespaces and Organizing Classes

- Updated OpenId classes to be in API namespace
- Updated PP Naming Convention to PayPal Naming Convention
- FormatConverter Class got its own namespace
- Handlers are grouped in Handler namespace
- Samples and Tests Updated Accordingly
This commit is contained in:
japatel
2014-12-17 17:15:01 -06:00
parent 20038e7525
commit 29a8d8f50d
246 changed files with 1068 additions and 1057 deletions

View File

@@ -1,38 +1,38 @@
<?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()));
}
}
<?php
// namespace PayPal\Test\Common;
use PayPal\Auth\OAuthTokenCredential;
use PayPal\Test\Constants;
use PayPal\Core\PayPalConfigManager;
use PayPal\Exception\PayPalConnectionException;
class OAuthTokenCredentialTest extends PHPUnit_Framework_TestCase
{
/**
* @group integration
*/
public function testGetAccessToken()
{
$cred = new OAuthTokenCredential(Constants::CLIENT_ID, Constants::CLIENT_SECRET);
$config = PayPalConfigManager::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\PayPalConnectionException');
$cred = new OAuthTokenCredential('dummy', 'secret');
$this->assertNull($cred->getAccessToken(PayPalConfigManager::getInstance()->getConfigHashmap()));
}
}