forked from LiveCarta/PayPal-PHP-SDK
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:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Address;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\AgreementStateDescriptor;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\AgreementTransactions;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\Agreement;
|
||||
|
||||
/**
|
||||
@@ -162,17 +162,17 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCreate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->create($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -181,17 +181,17 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExecute($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->execute("123123", $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->execute("123123", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -200,17 +200,17 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
AgreementTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("agreementId", $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->get("agreementId", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -219,18 +219,18 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUpdate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
$patchRequest = PatchRequestTest::getObject();
|
||||
|
||||
$result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->update($patchRequest, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -239,18 +239,18 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSuspend($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
|
||||
|
||||
$result = $obj->suspend($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->suspend($agreementStateDescriptor, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -259,18 +259,18 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testReActivate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
|
||||
|
||||
$result = $obj->reActivate($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->reActivate($agreementStateDescriptor, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -279,18 +279,18 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCancel($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
|
||||
|
||||
$result = $obj->cancel($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->cancel($agreementStateDescriptor, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -299,18 +299,18 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testBillBalance($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
|
||||
|
||||
$result = $obj->billBalance($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->billBalance($agreementStateDescriptor, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -319,18 +319,18 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSetBalance($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
$currency = CurrencyTest::getObject();
|
||||
|
||||
$result = $obj->setBalance($currency, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->setBalance($currency, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -339,17 +339,17 @@ class AgreementTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testTransactions($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
AgreementTransactionsTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->transactions("agreementId", $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->transactions("agreementId", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\AgreementTransaction;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\AgreementTransactions;
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@ use PayPal\Api\CreditCard;
|
||||
use PayPal\Api\Payment;
|
||||
use PayPal\Api\FundingInstrument;
|
||||
use PayPal\Api\Transaction;
|
||||
use PayPal\Exception\PPConnectionException;
|
||||
use PayPal\Exception\PayPalConnectionException;
|
||||
|
||||
class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@@ -165,7 +165,7 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
} catch (\InvalidArgumentException $ex) {
|
||||
$this->assertEquals($ex->getMessage(), "Id cannot be null");
|
||||
}
|
||||
} catch (PPConnectionException $ex) {
|
||||
} catch (PayPalConnectionException $ex) {
|
||||
$this->markTestSkipped(
|
||||
'Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()
|
||||
);
|
||||
@@ -186,7 +186,7 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
$authorization->setAmount($amount);
|
||||
try {
|
||||
$authorization->reauthorize();
|
||||
} catch (PPConnectionException $ex) {
|
||||
} catch (PayPalConnectionException $ex) {
|
||||
//var_dump($ex->getMessage());
|
||||
$this->assertEquals(strpos($ex->getMessage(), "500"), false);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\BankAccount;
|
||||
|
||||
/**
|
||||
@@ -318,17 +318,17 @@ class BankAccountTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCreate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->create($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -337,17 +337,17 @@ class BankAccountTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
BankAccountTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("bankAccountId", $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->get("bankAccountId", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -356,17 +356,17 @@ class BankAccountTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testDelete($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
|
||||
$result = $obj->delete($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->delete($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -375,18 +375,18 @@ class BankAccountTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUpdate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
$patchRequest = PatchRequestTest::getObject();
|
||||
|
||||
$result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->update($patchRequest, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\BankAccountsList;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\BankToken;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\BillingInfo;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\CancelNotification;
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@ use PayPal\Api\Capture;
|
||||
use PayPal\Api\Refund;
|
||||
use PayPal\Api\Authorization;
|
||||
use PayPal\Api\Amount;
|
||||
use PayPal\Exception\PPConnectionException;
|
||||
use PayPal\Exception\PayPalConnectionException;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class CaptureTest extends \PHPUnit_Framework_TestCase
|
||||
@@ -91,7 +91,7 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$retund = $capture->refund($refund);
|
||||
$this->assertNotNull($retund->getId());
|
||||
} catch (PPConnectionException $ex) {
|
||||
} catch (PayPalConnectionException $ex) {
|
||||
$this->markTestSkipped(
|
||||
'Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()
|
||||
);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\ChargeModel;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\FormatConverter;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Converter\FormatConverter;
|
||||
use PayPal\Validation\NumericValidator;
|
||||
use PayPal\Api\Cost;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\CreateProfileResponse;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\CreditCardList;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\CreditCard;
|
||||
|
||||
/**
|
||||
@@ -192,17 +192,17 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCreate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->create($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -211,17 +211,17 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
CreditCardTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("creditCardId", $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->get("creditCardId", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -230,17 +230,17 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testDelete($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
|
||||
$result = $obj->delete($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->delete($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -249,17 +249,17 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUpdate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->update($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->update($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\CreditCardToken;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Credit;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\FormatConverter;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Converter\FormatConverter;
|
||||
use PayPal\Validation\NumericValidator;
|
||||
use PayPal\Api\Currency;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\CustomAmount;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\ErrorDetails;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Error;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\ExtendedBankAccount;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\FlowConfig;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\FundingInstrument;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\HyperSchema;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Image;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\InputFields;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\InvoiceAddress;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\InvoiceItem;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\InvoiceSearchResponse;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\InvoiceSearchResponse;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\Invoice;
|
||||
|
||||
/**
|
||||
@@ -263,17 +263,17 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCreate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->create($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -282,18 +282,18 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSearch($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
InvoiceSearchResponseTest::getJson()
|
||||
));
|
||||
$search = SearchTest::getObject();
|
||||
|
||||
$result = $obj->search($search, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->search($search, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -302,17 +302,17 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSend($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
|
||||
$result = $obj->send($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->send($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -321,18 +321,18 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testRemind($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
$notification = NotificationTest::getObject();
|
||||
|
||||
$result = $obj->remind($notification, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->remind($notification, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -341,18 +341,18 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCancel($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
$cancelNotification = CancelNotificationTest::getObject();
|
||||
|
||||
$result = $obj->cancel($cancelNotification, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->cancel($cancelNotification, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -361,18 +361,18 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testRecordPayment($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
$paymentDetail = PaymentDetailTest::getObject();
|
||||
|
||||
$result = $obj->recordPayment($paymentDetail, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->recordPayment($paymentDetail, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -381,18 +381,18 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testRecordRefund($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
$refundDetail = RefundDetailTest::getObject();
|
||||
|
||||
$result = $obj->recordRefund($refundDetail, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->recordRefund($refundDetail, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -401,17 +401,17 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
InvoiceTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("invoiceId", $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->get("invoiceId", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -420,17 +420,17 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetAll($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
InvoiceSearchResponseTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->getAll(array(), $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->getAll(array(), $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -439,17 +439,17 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUpdate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->update($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->update($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -458,17 +458,17 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testDelete($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
|
||||
$result = $obj->delete($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->delete($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -477,17 +477,17 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testQrCode($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
ImageTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->qrCode("invoiceId", array(), $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->qrCode("invoiceId", array(), $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Links;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\MerchantInfo;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\MerchantPreferences;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Metadata;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Notification;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
<?php
|
||||
use PayPal\Auth\Openid\PPOpenIdAddress;
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\OpenIdAddress;
|
||||
|
||||
/**
|
||||
* Test class for PPOpenIdAddress.
|
||||
* Test class for OpenIdAddress.
|
||||
*
|
||||
*/
|
||||
class PPOpenIdAddressTest extends \PHPUnit_Framework_TestCase
|
||||
class OpenIdAddressTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/** @var PPOpenIdAddress */
|
||||
/** @var OpenIdAddress */
|
||||
private $addr;
|
||||
|
||||
/**
|
||||
@@ -30,7 +32,7 @@ class PPOpenIdAddressTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public static function getTestData()
|
||||
{
|
||||
$addr = new PPOpenIdAddress();
|
||||
$addr = new OpenIdAddress();
|
||||
$addr->setCountry("US")->setLocality("San Jose")
|
||||
->setPostalCode("95112")->setRegion("CA")
|
||||
->setStreetAddress("1, North 1'st street");
|
||||
@@ -42,7 +44,7 @@ class PPOpenIdAddressTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$addrCopy = new PPOpenIdAddress();
|
||||
$addrCopy = new OpenIdAddress();
|
||||
$addrCopy->fromJson($this->addr->toJson());
|
||||
|
||||
$this->assertEquals($this->addr, $addrCopy);
|
||||
@@ -1,15 +1,17 @@
|
||||
<?php
|
||||
|
||||
use PayPal\Auth\Openid\PPOpenIdError;
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\OpenIdError;
|
||||
|
||||
/**
|
||||
* Test class for PPOpenIdError.
|
||||
* Test class for OpenIdError.
|
||||
*
|
||||
*/
|
||||
class PPOpenIdErrorTest extends PHPUnit_Framework_TestCase
|
||||
class OpenIdErrorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/** @var PPOpenIdError */
|
||||
/** @var OpenIdError */
|
||||
private $error;
|
||||
|
||||
/**
|
||||
@@ -18,7 +20,7 @@ class PPOpenIdErrorTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->error = new PPOpenIdError();
|
||||
$this->error = new OpenIdError();
|
||||
$this->error->setErrorDescription('error description')
|
||||
->setErrorUri('http://developer.paypal.com/api/error')
|
||||
->setError('VALIDATION_ERROR');
|
||||
@@ -37,7 +39,7 @@ class PPOpenIdErrorTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$errorCopy = new PPOpenIdError();
|
||||
$errorCopy = new OpenIdError();
|
||||
$errorCopy->fromJson($this->error->toJson());
|
||||
|
||||
$this->assertEquals($this->error, $errorCopy);
|
||||
@@ -1,12 +1,15 @@
|
||||
<?php
|
||||
use PayPal\Common\PPApiContext;
|
||||
use PayPal\Auth\Openid\PPOpenIdSession;
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\OpenIdSession;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Test class for PPOpenIdSession.
|
||||
* Test class for OpenIdSession.
|
||||
*
|
||||
*/
|
||||
class PPOpenIdSessionTest extends \PHPUnit_Framework_TestCase
|
||||
class OpenIdSessionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $context;
|
||||
@@ -17,7 +20,7 @@ class PPOpenIdSessionTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->context = new \PayPal\Rest\ApiContext();
|
||||
$this->context = new ApiContext();
|
||||
$this->context->setConfig(
|
||||
array(
|
||||
'acct1.ClientId' => 'DummyId',
|
||||
@@ -49,16 +52,16 @@ class PPOpenIdSessionTest extends \PHPUnit_Framework_TestCase
|
||||
$expectedBaseUrl = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize";
|
||||
|
||||
$this->assertEquals($expectedBaseUrl . "?client_id=$clientId&response_type=code&scope=this+that+and+more+openid&redirect_uri=" . urlencode($redirectUri),
|
||||
PPOpenIdSession::getAuthorizationUrl($redirectUri, $scope, $clientId), "Failed case - custom scope");
|
||||
OpenIdSession::getAuthorizationUrl($redirectUri, $scope, $clientId), "Failed case - custom scope");
|
||||
|
||||
$scope = array();
|
||||
$this->assertEquals($expectedBaseUrl . "?client_id=$clientId&response_type=code&scope=openid+profile+address+email+phone+" . urlencode("https://uri.paypal.com/services/paypalattributes") . "+" . urlencode('https://uri.paypal.com/services/expresscheckout') . "&redirect_uri=" . urlencode($redirectUri),
|
||||
PPOpenIdSession::getAuthorizationUrl($redirectUri, $scope, $clientId), "Failed case - default scope");
|
||||
OpenIdSession::getAuthorizationUrl($redirectUri, $scope, $clientId), "Failed case - default scope");
|
||||
|
||||
|
||||
$scope = array('openid');
|
||||
$this->assertEquals($expectedBaseUrl . "?client_id=$clientId&response_type=code&scope=openid&redirect_uri=" . urlencode($redirectUri),
|
||||
PPOpenIdSession::getAuthorizationUrl($redirectUri, $scope, $clientId), "Failed case - openid scope");
|
||||
OpenIdSession::getAuthorizationUrl($redirectUri, $scope, $clientId), "Failed case - openid scope");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +76,7 @@ class PPOpenIdSessionTest extends \PHPUnit_Framework_TestCase
|
||||
$expectedBaseUrl = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize";
|
||||
|
||||
$this->assertEquals($expectedBaseUrl . "?client_id=DummyId&response_type=code&scope=this+that+and+more+openid&redirect_uri=" . urlencode($redirectUri),
|
||||
PPOpenIdSession::getAuthorizationUrl($redirectUri, $scope, "DummyId", null, null, $this->context), "Failed case - custom config");
|
||||
OpenIdSession::getAuthorizationUrl($redirectUri, $scope, "DummyId", null, null, $this->context), "Failed case - custom config");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,6 +91,6 @@ class PPOpenIdSessionTest extends \PHPUnit_Framework_TestCase
|
||||
$expectedBaseUrl = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/endsession";
|
||||
|
||||
$this->assertEquals($expectedBaseUrl . "?id_token=$idToken&redirect_uri=" . urlencode($redirectUri) . "&logout=true",
|
||||
PPOpenIdSession::getLogoutUrl($redirectUri, $idToken, $this->context), "Failed case - custom config");
|
||||
OpenIdSession::getLogoutUrl($redirectUri, $idToken, $this->context), "Failed case - custom config");
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
<?php
|
||||
use PayPal\Auth\Openid\PPOpenIdTokeninfo;
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\OpenIdTokeninfo;
|
||||
|
||||
/**
|
||||
* Test class for PPOpenIdTokeninfo.
|
||||
* Test class for OpenIdTokeninfo.
|
||||
*
|
||||
*/
|
||||
class PPOpenIdTokeninfoTest extends \PHPUnit_Framework_TestCase
|
||||
class OpenIdTokeninfoTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/** @var PPOpenIdTokeninfo */
|
||||
/** @var OpenIdTokeninfo */
|
||||
public $token;
|
||||
|
||||
/**
|
||||
@@ -17,7 +19,7 @@ class PPOpenIdTokeninfoTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->token = new PPOpenIdTokeninfo();
|
||||
$this->token = new OpenIdTokeninfo();
|
||||
$this->token->setAccessToken("Access token")
|
||||
->setExpiresIn(900)
|
||||
->setRefreshToken("Refresh token")
|
||||
@@ -39,7 +41,7 @@ class PPOpenIdTokeninfoTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$tokenCopy = new PPOpenIdTokeninfo();
|
||||
$tokenCopy = new OpenIdTokeninfo();
|
||||
$tokenCopy->fromJson($this->token->toJson());
|
||||
|
||||
$this->assertEquals($this->token, $tokenCopy);
|
||||
@@ -61,7 +63,7 @@ class PPOpenIdTokeninfoTest extends \PHPUnit_Framework_TestCase
|
||||
'client_id' => $clientId,
|
||||
'client_secret' => $clientSecret
|
||||
);
|
||||
$accessToken = PPOpenIdTokeninfo::createFromAuthorizationCode($params);
|
||||
$accessToken = OpenIdTokeninfo::createFromAuthorizationCode($params);
|
||||
$this->assertNotNull($accessToken);
|
||||
|
||||
$params = array(
|
||||
@@ -1,11 +1,14 @@
|
||||
<?php
|
||||
use PayPal\Auth\Openid\PPOpenIdUserinfo;
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\OpenIdUserinfo;
|
||||
|
||||
/**
|
||||
* Test class for PPOpenIdUserinfo.
|
||||
* Test class for OpenIdUserinfo.
|
||||
*
|
||||
*/
|
||||
class PPOpenIdUserinfoTest extends \PHPUnit_Framework_TestCase
|
||||
class OpenIdUserinfoTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
|
||||
@@ -31,7 +34,7 @@ class PPOpenIdUserinfoTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$user = new PPOpenIdUserinfo();
|
||||
$user = new OpenIdUserinfo();
|
||||
$user->setAccountType("PERSONAL")->setAgeRange("20-30")->setBirthday("1970-01-01")
|
||||
->setEmail("me@email.com")->setEmailVerified(true)
|
||||
->setFamilyName("Doe")->setMiddleName("A")->setGivenName("John")
|
||||
@@ -41,9 +44,9 @@ class PPOpenIdUserinfoTest extends \PHPUnit_Framework_TestCase
|
||||
->setSub("me@email.com")->setUserId("userId")
|
||||
->setVerified(true)->setVerifiedAccount(true)
|
||||
->setZoneinfo("America/PST")->setLanguage('en_US')
|
||||
->setAddress(PPOpenIdAddressTest::getTestData());
|
||||
->setAddress(OpenIdAddressTest::getTestData());
|
||||
|
||||
$userCopy = new PPOpenIdUserinfo();
|
||||
$userCopy = new OpenIdUserinfo();
|
||||
$userCopy->fromJson($user->toJSON());
|
||||
|
||||
$this->assertEquals($user, $userCopy);
|
||||
@@ -54,7 +57,7 @@ class PPOpenIdUserinfoTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInvalidParamUserInfoCall()
|
||||
{
|
||||
$this->setExpectedException('PayPal\Exception\PPConnectionException');
|
||||
PPOpenIdUserinfo::getUserinfo(array('access_token' => 'accessToken'));
|
||||
$this->setExpectedException('PayPal\Exception\PayPalConnectionException');
|
||||
OpenIdUserinfo::getUserinfo(array('access_token' => 'accessToken'));
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\OverrideChargeModel;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\PatchRequest;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Patch;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\PayerInfo;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Payer;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\PaymentCard;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\PaymentCardToken;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\PaymentDefinition;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\PaymentDetail;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\PaymentTerm;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Phone;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\PlanList;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\PlanList;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\Plan;
|
||||
|
||||
/**
|
||||
@@ -140,17 +140,17 @@ class PlanTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
PlanTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("planId", $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->get("planId", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -159,17 +159,17 @@ class PlanTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCreate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->create($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -178,18 +178,18 @@ class PlanTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUpdate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
$patchRequest = PatchRequestTest::getObject();
|
||||
|
||||
$result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->update($patchRequest, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -198,18 +198,18 @@ class PlanTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testList($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
PlanListTest::getJson()
|
||||
));
|
||||
$params = ParamsTest::getObject();
|
||||
|
||||
$result = $obj->all($params, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->all($params, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Presentation;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\RefundDetail;
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ use PayPal\Test\Constants;
|
||||
use PayPal\Test\Api\AmountTest;
|
||||
use PayPal\Test\Api\PaymentTest;
|
||||
use PayPal\Test\Api\LinksTest;
|
||||
use PayPal\Exception\PPConnectionException;
|
||||
use PayPal\Exception\PayPalConnectionException;
|
||||
|
||||
class SaleTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Search;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\ShippingAddress;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\ShippingCost;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\ShippingInfo;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Tax;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Terms;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\CreateProfileResponse;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\WebProfile;
|
||||
|
||||
/**
|
||||
@@ -110,17 +110,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCreate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
CreateProfileResponseTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->create($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -129,17 +129,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUpdate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
|
||||
$result = $obj->update($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->update($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -148,18 +148,18 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testPartialUpdate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
$patch = array(PatchTest::getObject());
|
||||
|
||||
$result = $obj->partial_update($patch, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->partial_update($patch, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -168,17 +168,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
WebProfileTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("profileId", $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->get("profileId", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -187,17 +187,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetList($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
json_encode(array(json_decode(WebProfileTest::getJson())))
|
||||
));
|
||||
|
||||
$result = $obj->get_list($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->get_list($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -206,17 +206,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testDelete($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
|
||||
$result = $obj->delete($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->delete($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\WebhookEventList;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\WebhookEventList;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\WebhookEvent;
|
||||
|
||||
/**
|
||||
@@ -123,17 +123,17 @@ class WebhookEventTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
WebhookEventTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("eventId", $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->get("eventId", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -142,17 +142,17 @@ class WebhookEventTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testResend($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->resend($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->resend($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -161,18 +161,18 @@ class WebhookEventTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testList($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
WebhookEventListTest::getJson()
|
||||
));
|
||||
$params = array();
|
||||
|
||||
$result = $obj->all($params, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->all($params, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\WebhookEventTypeList;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\WebhookEventList;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\WebhookEventType;
|
||||
|
||||
/**
|
||||
@@ -86,17 +86,17 @@ class WebhookEventTypeTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSubscribedEventTypes($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
WebhookEventTypeListTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->subscribedEventTypes("webhookId", $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->subscribedEventTypes("webhookId", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -105,17 +105,17 @@ class WebhookEventTypeTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testAvailableEventTypes($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
WebhookEventTypeListTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->availableEventTypes($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->availableEventTypes($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\WebhookList;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\ResourceModel;
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\WebhookList;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\Webhook;
|
||||
|
||||
/**
|
||||
@@ -108,17 +108,17 @@ class WebhookTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCreate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->create($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -127,17 +127,17 @@ class WebhookTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
WebhookTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("webhookId", $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->get("webhookId", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -146,17 +146,17 @@ class WebhookTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetAll($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
WebhookListTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->getAll($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->getAll($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -165,18 +165,18 @@ class WebhookTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUpdate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
$patchRequest = PatchRequestTest::getObject();
|
||||
|
||||
$result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->update($patchRequest, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
@@ -185,17 +185,17 @@ class WebhookTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testDelete($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
|
||||
$result = $obj->delete($mockApiContext, $mockPPRestCall);
|
||||
$result = $obj->delete($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
|
||||
class ArrayClass extends PPModel
|
||||
class ArrayClass extends PayPalModel
|
||||
{
|
||||
|
||||
public function setName($name)
|
||||
@@ -38,4 +38,4 @@ class ArrayClass extends PPModel
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
|
||||
use PayPal\Common\PPArrayUtil;
|
||||
|
||||
class ArrayUtilTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testIsAssocArray()
|
||||
{
|
||||
|
||||
$arr = array(1, 2, 3);
|
||||
$this->assertEquals(false, PPArrayUtil::isAssocArray($arr));
|
||||
|
||||
$arr = array(
|
||||
'name' => 'John Doe',
|
||||
'City' => 'San Jose'
|
||||
);
|
||||
$this->assertEquals(true, PPArrayUtil::isAssocArray($arr));
|
||||
|
||||
$arr[] = 'CA';
|
||||
$this->assertEquals(false, PPArrayUtil::isAssocArray($arr));
|
||||
}
|
||||
}
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
|
||||
use PayPal\Common\ArrayUtil;
|
||||
|
||||
class ArrayUtilTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testIsAssocArray()
|
||||
{
|
||||
|
||||
$arr = array(1, 2, 3);
|
||||
$this->assertEquals(false, ArrayUtil::isAssocArray($arr));
|
||||
|
||||
$arr = array(
|
||||
'name' => 'John Doe',
|
||||
'City' => 'San Jose'
|
||||
);
|
||||
$this->assertEquals(true, ArrayUtil::isAssocArray($arr));
|
||||
|
||||
$arr[] = 'CA';
|
||||
$this->assertEquals(false, ArrayUtil::isAssocArray($arr));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
|
||||
class ChildClass extends SimpleClass
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ use PayPal\Api\Amount;
|
||||
use PayPal\Api\Currency;
|
||||
use PayPal\Api\Details;
|
||||
use PayPal\Api\Item;
|
||||
use PayPal\Common\FormatConverter;
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Converter\FormatConverter;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Test\Validation\NumericValidatorTest;
|
||||
|
||||
class FormatConverterTest extends \PHPUnit_Framework_TestCase
|
||||
@@ -118,7 +118,7 @@ class FormatConverterTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @dataProvider apiModelSettersProvider
|
||||
*
|
||||
* @param PPModel $class Class Object
|
||||
* @param PayPalModel $class Class Object
|
||||
* @param string $method Method Name where the format is being applied
|
||||
* @param array $values array of ['input', 'expectedResponse'] is provided
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
|
||||
use PayPal\Core\PPConfigManager;
|
||||
use PayPal\Core\PayPalConfigManager;
|
||||
|
||||
class ModelTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@@ -90,7 +90,7 @@ class ModelTest extends \PHPUnit_Framework_TestCase
|
||||
try {
|
||||
$obj->invalid = "value2";
|
||||
$this->assertEquals($obj->invalid, "value2");
|
||||
if (PPConfigManager::getInstance()->get('validation.level') == 'strict') {
|
||||
if (PayPalConfigManager::getInstance()->get('validation.level') == 'strict') {
|
||||
$this->fail("It should have thrown a Notice Error");
|
||||
}
|
||||
} catch (\PHPUnit_Framework_Error_Notice $ex) {
|
||||
@@ -100,7 +100,7 @@ class ModelTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testInvalidMagicMethodWithDisabledValidation()
|
||||
{
|
||||
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'disabled'));
|
||||
PayPalConfigManager::getInstance()->addConfigs(array('validation.level' => 'disabled'));
|
||||
$obj = new SimpleClass();
|
||||
try {
|
||||
$obj->invalid = "value2";
|
||||
@@ -108,16 +108,16 @@ class ModelTest extends \PHPUnit_Framework_TestCase
|
||||
} catch (\PHPUnit_Framework_Error_Notice $ex) {
|
||||
$this->fail("It should not have thrown a Notice Error as it is disabled.");
|
||||
}
|
||||
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'strict'));
|
||||
PayPalConfigManager::getInstance()->addConfigs(array('validation.level' => 'strict'));
|
||||
}
|
||||
|
||||
public function testInvalidMagicMethodWithValidationLevel()
|
||||
{
|
||||
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'log'));
|
||||
PayPalConfigManager::getInstance()->addConfigs(array('validation.level' => 'log'));
|
||||
$obj = new SimpleClass();
|
||||
$obj->invalid2 = "value2";
|
||||
$this->assertEquals($obj->invalid2, "value2");
|
||||
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'strict'));
|
||||
PayPalConfigManager::getInstance()->addConfigs(array('validation.level' => 'strict'));
|
||||
}
|
||||
|
||||
public function testArrayClassConversion()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
|
||||
class NestedClass extends PPModel
|
||||
class NestedClass extends PayPalModel
|
||||
{
|
||||
|
||||
public function setId($id)
|
||||
@@ -33,4 +33,4 @@ class NestedClass extends PPModel
|
||||
{
|
||||
return $this->info;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
|
||||
class SimpleModelTestClass extends PPModel
|
||||
class SimpleModelTestClass extends PayPalModel
|
||||
{
|
||||
/**
|
||||
*
|
||||
@@ -49,7 +49,7 @@ class SimpleModelTestClass extends PPModel
|
||||
}
|
||||
|
||||
|
||||
class ContainerModelTestClass extends PPModel
|
||||
class ContainerModelTestClass extends PayPalModel
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ class ContainerModelTestClass extends PPModel
|
||||
|
||||
}
|
||||
|
||||
class ListModelTestClass extends PPModel
|
||||
class ListModelTestClass extends PayPalModel
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -145,10 +145,10 @@ class ListModelTestClass extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Test class for PPModel.
|
||||
* Test class for PayPalModel.
|
||||
*
|
||||
*/
|
||||
class PPModelTest extends PHPUnit_Framework_TestCase
|
||||
class PayPalModelTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
@@ -245,4 +245,4 @@ class PPModelTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($parent, $parentCopy);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Common;
|
||||
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
|
||||
class SimpleClass extends PPModel
|
||||
class SimpleClass extends PayPalModel
|
||||
{
|
||||
|
||||
public function setName($name)
|
||||
@@ -25,4 +25,4 @@ class SimpleClass extends PPModel
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
<?php
|
||||
|
||||
use PayPal\Common\PPUserAgent;
|
||||
|
||||
class UserAgentTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testGetValue()
|
||||
{
|
||||
$ua = PPUserAgent::getValue("name", "version");
|
||||
list($id, $version, $features) = sscanf($ua, "PayPalSDK/%s %s (%s)");
|
||||
|
||||
// Check that we pass the useragent in the expected format
|
||||
$this->assertNotNull($id);
|
||||
$this->assertNotNull($version);
|
||||
$this->assertNotNull($features);
|
||||
|
||||
$this->assertEquals("name", $id);
|
||||
$this->assertEquals("version", $version);
|
||||
|
||||
// Check that we pass in these mininal features
|
||||
$this->assertThat($features, $this->stringContains("OS="));
|
||||
$this->assertThat($features, $this->stringContains("Bit="));
|
||||
$this->assertThat($features, $this->stringContains("Lang="));
|
||||
$this->assertThat($features, $this->stringContains("V="));
|
||||
$this->assertGreaterThan(5, count(explode(';', $features)));
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
use PayPal\Common\PayPalUserAgent;
|
||||
|
||||
class UserAgentTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testGetValue()
|
||||
{
|
||||
$ua = PayPalUserAgent::getValue("name", "version");
|
||||
list($id, $version, $features) = sscanf($ua, "PayPalSDK/%s %s (%s)");
|
||||
|
||||
// Check that we pass the useragent in the expected format
|
||||
$this->assertNotNull($id);
|
||||
$this->assertNotNull($version);
|
||||
$this->assertNotNull($features);
|
||||
|
||||
$this->assertEquals("name", $id);
|
||||
$this->assertEquals("version", $version);
|
||||
|
||||
// Check that we pass in these mininal features
|
||||
$this->assertThat($features, $this->stringContains("OS="));
|
||||
$this->assertThat($features, $this->stringContains("Bit="));
|
||||
$this->assertThat($features, $this->stringContains("Lang="));
|
||||
$this->assertThat($features, $this->stringContains("V="));
|
||||
$this->assertGreaterThan(5, count(explode(';', $features)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
use PayPal\Core\PPConfigManager;
|
||||
use PayPal\Core\PayPalConfigManager;
|
||||
|
||||
class PPConfigManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PPConfigManager
|
||||
* @var PayPalConfigManager
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
@@ -14,7 +14,7 @@ class PPConfigManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = new \ReflectionClass('PayPal\Core\PPConfigManager');
|
||||
$this->object = new \ReflectionClass('PayPal\Core\PayPalConfigManager');
|
||||
runkit_constant_remove('PP_CONFIG_PATH');
|
||||
}
|
||||
|
||||
@@ -32,10 +32,10 @@ class PPConfigManagerTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetInstance()
|
||||
{
|
||||
define("PP_CONFIG_PATH", dirname(dirname(dirname(__DIR__))));
|
||||
$this->object = PPConfigManager::getInstance();
|
||||
$this->object = PayPalConfigManager::getInstance();
|
||||
$instance = $this->object->getInstance();
|
||||
$instance2 = $this->object->getInstance();
|
||||
$this->assertTrue($instance instanceof PPConfigManager);
|
||||
$this->assertTrue($instance instanceof PayPalConfigManager);
|
||||
$this->assertSame($instance, $instance2);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class PPConfigManagerTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGet()
|
||||
{
|
||||
define("PP_CONFIG_PATH", dirname(dirname(dirname(__DIR__))));
|
||||
$this->object = PPConfigManager::getInstance();
|
||||
$this->object = PayPalConfigManager::getInstance();
|
||||
$ret = $this->object->get('acct2');
|
||||
$this->assertConfiguration(
|
||||
array('acct2.ClientId' => 'TestClientId', 'acct2.ClientSecret' => 'TestClientSecret'),
|
||||
@@ -57,7 +57,7 @@ class PPConfigManagerTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetIniPrefix()
|
||||
{
|
||||
define("PP_CONFIG_PATH", dirname(dirname(dirname(__DIR__))));
|
||||
$this->object = PPConfigManager::getInstance();
|
||||
$this->object = PayPalConfigManager::getInstance();
|
||||
|
||||
$ret = $this->object->getIniPrefix();
|
||||
$this->assertContains('acct1', $ret);
|
||||
@@ -71,10 +71,10 @@ class PPConfigManagerTest extends \PHPUnit_Framework_TestCase
|
||||
public function testConfigByDefault()
|
||||
{
|
||||
define("PP_CONFIG_PATH", dirname(dirname(dirname(__DIR__))));
|
||||
$this->object = PPConfigManager::getInstance();
|
||||
$this->object = PayPalConfigManager::getInstance();
|
||||
|
||||
// Test file based config params and defaults
|
||||
$config = PPConfigManager::getInstance()->getConfigHashmap();
|
||||
$config = PayPalConfigManager::getInstance()->getConfigHashmap();
|
||||
$this->assertConfiguration(array('mode' => 'sandbox', 'http.ConnectionTimeOut' => '60'), $config);
|
||||
}
|
||||
|
||||
@@ -82,25 +82,25 @@ class PPConfigManagerTest extends \PHPUnit_Framework_TestCase
|
||||
public function testConfigByCustom()
|
||||
{
|
||||
define("PP_CONFIG_PATH", dirname(dirname(dirname(__DIR__))));
|
||||
$this->object = PPConfigManager::getInstance();
|
||||
$this->object = PayPalConfigManager::getInstance();
|
||||
|
||||
// Test custom config params and defaults
|
||||
$config = PPConfigManager::getInstance()->addConfigs(array('mode' => 'custom', 'http.ConnectionTimeOut' => 900))->getConfigHashmap();
|
||||
$config = PayPalConfigManager::getInstance()->addConfigs(array('mode' => 'custom', 'http.ConnectionTimeOut' => 900))->getConfigHashmap();
|
||||
$this->assertConfiguration(array('mode' => 'custom', 'http.ConnectionTimeOut' => '900'), $config);
|
||||
}
|
||||
|
||||
|
||||
public function testConfigByFileAndCustom() {
|
||||
define("PP_CONFIG_PATH", __DIR__. '/non_existent/');
|
||||
$this->object = PPConfigManager::getInstance();
|
||||
$this->object = PayPalConfigManager::getInstance();
|
||||
|
||||
$config = PPConfigManager::getInstance()->getConfigHashmap();
|
||||
$config = PayPalConfigManager::getInstance()->getConfigHashmap();
|
||||
$this->assertArrayHasKey('http.ConnectionTimeOut', $config);
|
||||
$this->assertEquals('30', $config['http.ConnectionTimeOut']);
|
||||
$this->assertEquals('5', $config['http.Retry']);
|
||||
|
||||
//Add more configs
|
||||
$config = PPConfigManager::getInstance()->addConfigs(array('http.Retry' => "10", 'mode' => 'sandbox'))->getConfigHashmap();
|
||||
$config = PayPalConfigManager::getInstance()->addConfigs(array('http.Retry' => "10", 'mode' => 'sandbox'))->getConfigHashmap();
|
||||
$this->assertConfiguration(array('http.ConnectionTimeOut' => "30", 'http.Retry' => "10", 'mode' => 'sandbox'), $config);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
use PayPal\Core\PPCredentialManager;
|
||||
use PayPal\Core\PayPalCredentialManager;
|
||||
|
||||
/**
|
||||
* Test class for PPCredentialManager.
|
||||
* Test class for PayPalCredentialManager.
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
*/
|
||||
class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
class PayPalCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PPCredentialManager
|
||||
* @var PayPalCredentialManager
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
@@ -34,7 +34,7 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = PPCredentialManager::getInstance($this->config);
|
||||
$this->object = PayPalCredentialManager::getInstance($this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetInstance()
|
||||
{
|
||||
$instance = $this->object->getInstance($this->config);
|
||||
$this->assertTrue($instance instanceof PPCredentialManager);
|
||||
$this->assertTrue($instance instanceof PayPalCredentialManager);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @after testGetDefaultCredentialObject
|
||||
*
|
||||
* @throws \PayPal\Exception\PPInvalidCredentialException
|
||||
* @throws \PayPal\Exception\PayPalInvalidCredentialException
|
||||
*/
|
||||
public function testSetCredentialObject()
|
||||
{
|
||||
@@ -84,7 +84,7 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @after testGetDefaultCredentialObject
|
||||
*
|
||||
* @throws \PayPal\Exception\PPInvalidCredentialException
|
||||
* @throws \PayPal\Exception\PayPalInvalidCredentialException
|
||||
*/
|
||||
public function testSetCredentialObjectWithUserId()
|
||||
{
|
||||
@@ -99,7 +99,7 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @after testGetDefaultCredentialObject
|
||||
*
|
||||
* @throws \PayPal\Exception\PPInvalidCredentialException
|
||||
* @throws \PayPal\Exception\PayPalInvalidCredentialException
|
||||
*/
|
||||
public function testSetCredentialObjectWithoutDefault()
|
||||
{
|
||||
@@ -117,7 +117,7 @@ class PPCredentialManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetInvalidCredentialObject()
|
||||
{
|
||||
$this->setExpectedException('PayPal\Exception\PPInvalidCredentialException');
|
||||
$this->setExpectedException('PayPal\Exception\PayPalInvalidCredentialException');
|
||||
$cred = $this->object->getCredentialObject('invalid_biz_api1.gmail.com');
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
namespace PayPal\Test\Core;
|
||||
|
||||
use PayPal\Core\PPHttpConfig;
|
||||
use PayPal\Core\PayPalHttpConfig;
|
||||
|
||||
/**
|
||||
* Test class for PPAPIService.
|
||||
* Test class for PayPalHttpConfigTest.
|
||||
*
|
||||
*/
|
||||
class PPHttpConfigTest extends \PHPUnit_Framework_TestCase
|
||||
class PayPalHttpConfigTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
protected $object;
|
||||
@@ -40,7 +40,7 @@ class PPHttpConfigTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testHeaderFunctions()
|
||||
{
|
||||
$o = new PPHttpConfig();
|
||||
$o = new PayPalHttpConfig();
|
||||
$o->addHeader('key1', 'value1');
|
||||
$o->addHeader('key2', 'value');
|
||||
$o->addHeader('key2', 'overwritten');
|
||||
@@ -49,7 +49,7 @@ class PPHttpConfigTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('overwritten', $o->getHeader('key2'));
|
||||
$this->assertNull($o->getHeader('key3'));
|
||||
|
||||
$o = new PPHttpConfig();
|
||||
$o = new PayPalHttpConfig();
|
||||
$o->addHeader('key1', 'value1');
|
||||
$o->addHeader('key2', 'value');
|
||||
$o->addHeader('key2', 'and more', false);
|
||||
@@ -67,7 +67,7 @@ class PPHttpConfigTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCurlOpts()
|
||||
{
|
||||
$o = new PPHttpConfig();
|
||||
$o = new PayPalHttpConfig();
|
||||
$o->setCurlOptions(array('k' => 'v'));
|
||||
|
||||
$curlOpts = $o->getCurlOptions();
|
||||
@@ -77,7 +77,7 @@ class PPHttpConfigTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testRemoveCurlOpts()
|
||||
{
|
||||
$o = new PPHttpConfig();
|
||||
$o = new PayPalHttpConfig();
|
||||
$o->setCurlOptions(array('k' => 'v'));
|
||||
$curlOpts = $o->getCurlOptions();
|
||||
$this->assertEquals(1, count($curlOpts));
|
||||
@@ -94,7 +94,7 @@ class PPHttpConfigTest extends \PHPUnit_Framework_TestCase
|
||||
public function testUserAgent()
|
||||
{
|
||||
$ua = 'UAString';
|
||||
$o = new PPHttpConfig();
|
||||
$o = new PayPalHttpConfig();
|
||||
$o->setUserAgent($ua);
|
||||
|
||||
$curlOpts = $o->getCurlOptions();
|
||||
@@ -109,7 +109,7 @@ class PPHttpConfigTest extends \PHPUnit_Framework_TestCase
|
||||
$sslCert = '../cacert.pem';
|
||||
$sslPass = 'passPhrase';
|
||||
|
||||
$o = new PPHttpConfig();
|
||||
$o = new PayPalHttpConfig();
|
||||
$o->setSSLCert($sslCert, $sslPass);
|
||||
|
||||
$curlOpts = $o->getCurlOptions();
|
||||
@@ -124,14 +124,14 @@ class PPHttpConfigTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$proxy = 'http://me:secret@hostname:8081';
|
||||
|
||||
$o = new PPHttpConfig();
|
||||
$o = new PayPalHttpConfig();
|
||||
$o->setHttpProxy($proxy);
|
||||
|
||||
$curlOpts = $o->getCurlOptions();
|
||||
$this->assertEquals('hostname:8081', $curlOpts[CURLOPT_PROXY]);
|
||||
$this->assertEquals('me:secret', $curlOpts[CURLOPT_PROXYUSERPWD]);
|
||||
|
||||
$this->setExpectedException('PayPal\Exception\PPConfigurationException');
|
||||
$this->setExpectedException('PayPal\Exception\PayPalConfigurationException');
|
||||
$o->setHttpProxy('invalid string');
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
use PayPal\Core\PPLoggingManager;
|
||||
use PayPal\Core\PayPalLoggingManager;
|
||||
|
||||
/**
|
||||
* Test class for PPLoggingManager.
|
||||
* Test class for PayPalLoggingManager.
|
||||
*
|
||||
*/
|
||||
class PPLoggingManagerTest extends \PHPUnit_Framework_TestCase
|
||||
class PayPalLoggingManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PPLoggingManager
|
||||
* @var PayPalLoggingManager
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
@@ -18,7 +18,7 @@ class PPLoggingManagerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = PPLoggingManager::getInstance('InvoiceTest');
|
||||
$this->object = PayPalLoggingManager::getInstance('InvoiceTest');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
use PayPal\Exception\PPConfigurationException;
|
||||
use PayPal\Exception\PayPalConfigurationException;
|
||||
|
||||
/**
|
||||
* Test class for PPConfigurationException.
|
||||
* Test class for PayPalConfigurationException.
|
||||
*
|
||||
*/
|
||||
class PPConfigurationExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
class PayPalConfigurationExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PPConfigurationException
|
||||
* @var PayPalConfigurationException
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
@@ -18,7 +18,7 @@ class PPConfigurationExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = new PPConfigurationException('Test PPConfigurationException');
|
||||
$this->object = new PayPalConfigurationException('Test PayPalConfigurationException');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ class PPConfigurationExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testPPConfigurationException()
|
||||
{
|
||||
$this->assertEquals('Test PPConfigurationException', $this->object->getMessage());
|
||||
$this->assertEquals('Test PayPalConfigurationException', $this->object->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
use PayPal\Exception\PPConnectionException;
|
||||
use PayPal\Exception\PayPalConnectionException;
|
||||
|
||||
/**
|
||||
* Test class for PPConnectionException.
|
||||
* Test class for PayPalConnectionException.
|
||||
*
|
||||
*/
|
||||
class PPConnectionExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
class PayPalConnectionExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PPConnectionException
|
||||
* @var PayPalConnectionException
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
@@ -18,7 +18,7 @@ class PPConnectionExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = new PPConnectionException('http://testURL', 'test message');
|
||||
$this->object = new PayPalConnectionException('http://testURL', 'test message');
|
||||
$this->object->setData('response payload for connection');
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
use PayPal\Exception\PPMissingCredentialException;
|
||||
use PayPal\Exception\PayPalInvalidCredentialException;
|
||||
|
||||
/**
|
||||
* Test class for PPMissingCredentialException.
|
||||
* Test class for PayPalInvalidCredentialException.
|
||||
*
|
||||
*/
|
||||
class PPMissingCredentialExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
class PayPalInvalidCredentialExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PPMissingCredentialException
|
||||
* @var PayPalInvalidCredentialException
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
@@ -18,7 +18,7 @@ class PPMissingCredentialExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = new PPMissingCredentialException;
|
||||
$this->object = new PayPalInvalidCredentialException;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
use PayPal\Exception\PPInvalidCredentialException;
|
||||
use PayPal\Exception\PayPalMissingCredentialException;
|
||||
|
||||
/**
|
||||
* Test class for PPInvalidCredentialException.
|
||||
* Test class for PayPalMissingCredentialException.
|
||||
*
|
||||
*/
|
||||
class PPInvalidCredentialExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
class PayPalMissingCredentialExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PPInvalidCredentialException
|
||||
* @var PayPalMissingCredentialException
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
@@ -18,7 +18,7 @@ class PPInvalidCredentialExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->object = new PPInvalidCredentialException;
|
||||
$this->object = new PayPalMissingCredentialException;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -8,12 +8,12 @@ use PayPal\Api\Currency;
|
||||
use PayPal\Api\Patch;
|
||||
use PayPal\Api\PatchRequest;
|
||||
use PayPal\Api\Plan;
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\CreateProfileResponse;
|
||||
use PayPal\Test\Functional\Setup;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\WebProfile;
|
||||
|
||||
/**
|
||||
@@ -28,7 +28,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public $response;
|
||||
|
||||
public $mockPPRestCall;
|
||||
public $mockPayPalRestCall;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
@@ -67,7 +67,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$agreement = new Agreement($request);
|
||||
// Update the Schema to use a working Plan
|
||||
$agreement->getPlan()->setId($plan->getId());
|
||||
$result = $agreement->create(null, $this->mockPPRestCall);
|
||||
$result = $agreement->create(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
return $result;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$paymentToken = $result['token'];
|
||||
$this->assertNotNull($paymentToken);
|
||||
$this->assertNotEmpty($paymentToken);
|
||||
$result = $agreement->execute($paymentToken, null, $this->mockPPRestCall);
|
||||
$result = $agreement->execute($paymentToken, null, $this->mockPayPalRestCall);
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$agreement = new Agreement($request);
|
||||
// Update the Schema to use a working Plan
|
||||
$agreement->getPlan()->setId($plan->getId());
|
||||
$result = $agreement->create(null, $this->mockPPRestCall);
|
||||
$result = $agreement->create(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
return $result;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($agreement)
|
||||
{
|
||||
$result = Agreement::get($agreement->getId(), null, $this->mockPPRestCall);
|
||||
$result = Agreement::get($agreement->getId(), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($agreement->getId(), $result->getId());
|
||||
return $result;
|
||||
@@ -136,7 +136,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$patches[] = $patch;
|
||||
$patchRequest = new PatchRequest();
|
||||
$patchRequest->setPatches($patches);
|
||||
$result = $agreement->update($patchRequest, null, $this->mockPPRestCall);
|
||||
$result = $agreement->update($patchRequest, null, $this->mockPayPalRestCall);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->markTestSkipped('Skipped as the fix is on the way.');
|
||||
$currency = new Currency($this->operation['request']['body']);
|
||||
$result = $agreement->setBalance($currency, null, $this->mockPPRestCall);
|
||||
$result = $agreement->setBalance($currency, null, $this->mockPayPalRestCall);
|
||||
$this->assertTrue($result);
|
||||
return $agreement;
|
||||
}
|
||||
@@ -163,7 +163,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->markTestSkipped('Skipped as the fix is on the way.');
|
||||
$agreementStateDescriptor = new AgreementStateDescriptor($this->operation['request']['body']);
|
||||
$result = $agreement->billBalance($agreementStateDescriptor, null, $this->mockPPRestCall);
|
||||
$result = $agreement->billBalance($agreementStateDescriptor, null, $this->mockPayPalRestCall);
|
||||
$this->assertTrue($result);
|
||||
return $agreement;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetTransactions($agreement)
|
||||
{
|
||||
$this->markTestSkipped('Skipped as the fix is on the way.');
|
||||
$result = Agreement::transactions($agreement->getId(), null, $this->mockPPRestCall);
|
||||
$result = Agreement::transactions($agreement->getId(), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
public function testSuspend($agreement)
|
||||
{
|
||||
$agreementStateDescriptor = new AgreementStateDescriptor($this->operation['request']['body']);
|
||||
$result = $agreement->suspend($agreementStateDescriptor, null, $this->mockPPRestCall);
|
||||
$result = $agreement->suspend($agreementStateDescriptor, null, $this->mockPayPalRestCall);
|
||||
$this->setupTest($this->getClassName(), 'testGetSuspended');
|
||||
$get = $this->testGet($agreement);
|
||||
$this->assertTrue($result);
|
||||
@@ -204,7 +204,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
public function testReactivate($agreement)
|
||||
{
|
||||
$agreementStateDescriptor = new AgreementStateDescriptor($this->operation['request']['body']);
|
||||
$result = $agreement->reActivate($agreementStateDescriptor, null, $this->mockPPRestCall);
|
||||
$result = $agreement->reActivate($agreementStateDescriptor, null, $this->mockPayPalRestCall);
|
||||
$this->assertTrue($result);
|
||||
$this->setupTest($this->getClassName(), 'testGet');
|
||||
$get = $this->testGet($agreement);
|
||||
@@ -220,7 +220,7 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
public function testCancel($agreement)
|
||||
{
|
||||
$agreementStateDescriptor = new AgreementStateDescriptor($this->operation['request']['body']);
|
||||
$result = $agreement->cancel($agreementStateDescriptor, null, $this->mockPPRestCall);
|
||||
$result = $agreement->cancel($agreementStateDescriptor, null, $this->mockPayPalRestCall);
|
||||
$this->assertTrue($result);
|
||||
$this->setupTest($this->getClassName(), 'testGetCancelled');
|
||||
$get = $this->testGet($agreement);
|
||||
|
||||
@@ -6,13 +6,13 @@ use PayPal\Api\Patch;
|
||||
use PayPal\Api\PatchRequest;
|
||||
use PayPal\Api\Plan;
|
||||
use PayPal\Auth\OAuthTokenCredential;
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Core\PPCredentialManager;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Core\PayPalCredentialManager;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\CreateProfileResponse;
|
||||
use PayPal\Test\Functional\Setup;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\WebProfile;
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ class BillingPlansFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public $mode = 'mock';
|
||||
|
||||
public $mockPPRestCall;
|
||||
public $mockPayPalRestCall;
|
||||
|
||||
public $context;
|
||||
|
||||
@@ -86,7 +86,7 @@ class BillingPlansFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$obj = new Plan($request);
|
||||
$result = $obj->create(null, $this->mockPPRestCall);
|
||||
$result = $obj->create(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
self::$obj = $result;
|
||||
return $result;
|
||||
@@ -96,7 +96,7 @@ class BillingPlansFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$obj = new Plan($request);
|
||||
$result = $obj->create(null, $this->mockPPRestCall);
|
||||
$result = $obj->create(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
return $result;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ class BillingPlansFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($plan)
|
||||
{
|
||||
$result = Plan::get($plan->getId(), null, $this->mockPPRestCall);
|
||||
$result = Plan::get($plan->getId(), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($plan->getId(), $result->getId());
|
||||
$this->assertEquals($plan, $result, "", 0, 10, true);
|
||||
@@ -121,7 +121,7 @@ class BillingPlansFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetList($plan)
|
||||
{
|
||||
$result = Plan::all(array('page_size' => '20', 'total_required' => 'yes'), null, $this->mockPPRestCall);
|
||||
$result = Plan::all(array('page_size' => '20', 'total_required' => 'yes'), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$totalPages = $result->getTotalPages();
|
||||
$found = false;
|
||||
@@ -135,7 +135,7 @@ class BillingPlansFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
$result = Plan::all(array('page' => --$totalPages, 'page_size' => '20', 'total_required' => 'yes'), null, $this->mockPPRestCall);
|
||||
$result = Plan::all(array('page' => --$totalPages, 'page_size' => '20', 'total_required' => 'yes'), null, $this->mockPayPalRestCall);
|
||||
|
||||
}
|
||||
} while ($totalPages > 0 && $found == false);
|
||||
@@ -160,7 +160,7 @@ class BillingPlansFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$patches[] = $patch;
|
||||
$patchRequest = new PatchRequest();
|
||||
$patchRequest->setPatches($patches);
|
||||
$result = $plan->update($patchRequest, null, $this->mockPPRestCall);
|
||||
$result = $plan->update($patchRequest, null, $this->mockPayPalRestCall);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ class BillingPlansFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$patches[] = $patch;
|
||||
$patchRequest = new PatchRequest();
|
||||
$patchRequest->setPatches($patches);
|
||||
$result = $plan->update($patchRequest, null, $this->mockPPRestCall);
|
||||
$result = $plan->update($patchRequest, null, $this->mockPayPalRestCall);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -202,8 +202,8 @@ class BillingPlansFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$patches[] = $patch;
|
||||
$patchRequest = new PatchRequest();
|
||||
$patchRequest->setPatches($patches);
|
||||
$result = $plan->update($patchRequest, null, $this->mockPPRestCall);
|
||||
$result = $plan->update($patchRequest, null, $this->mockPayPalRestCall);
|
||||
$this->assertTrue($result);
|
||||
return Plan::get($plan->getId(), null, $this->mockPPRestCall);
|
||||
return Plan::get($plan->getId(), null, $this->mockPayPalRestCall);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public $response;
|
||||
|
||||
public $mockPPRestCall;
|
||||
public $mockPayPalRestCall;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
@@ -58,7 +58,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$obj = new Invoice($request);
|
||||
$result = $obj->create(null, $this->mockPPRestCall);
|
||||
$result = $obj->create(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
self::$obj = $result;
|
||||
return $result;
|
||||
@@ -71,7 +71,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($invoice)
|
||||
{
|
||||
$result = Invoice::get($invoice->getId(), null, $this->mockPPRestCall);
|
||||
$result = Invoice::get($invoice->getId(), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($invoice->getId(), $result->getId());
|
||||
return $result;
|
||||
@@ -84,7 +84,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSend($invoice)
|
||||
{
|
||||
$result = $invoice->send(null, $this->mockPPRestCall);
|
||||
$result = $invoice->send(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
return $invoice;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
public function testUpdate($invoice)
|
||||
{
|
||||
$this->markTestSkipped('Skipped as the fix is on the way. #PPTIPS-1932');
|
||||
$result = $invoice->update(null, $this->mockPPRestCall);
|
||||
$result = $invoice->update(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($invoice->getId(), $result->getId());
|
||||
}
|
||||
@@ -109,7 +109,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetAll($invoice)
|
||||
{
|
||||
$result = Invoice::getAll(array('page_size' => '20', 'total_count_required' => 'true'), null, $this->mockPPRestCall);
|
||||
$result = Invoice::getAll(array('page_size' => '20', 'total_count_required' => 'true'), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertNotNull($result->getTotalCount());
|
||||
$totalPages = ceil($result->getTotalCount()/20);
|
||||
@@ -124,7 +124,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
$result = Invoice::getAll(array('page' => --$totalPages, 'page_size' => '20', 'total_required' => 'yes'), null, $this->mockPPRestCall);
|
||||
$result = Invoice::getAll(array('page' => --$totalPages, 'page_size' => '20', 'total_required' => 'yes'), null, $this->mockPayPalRestCall);
|
||||
|
||||
}
|
||||
} while ($totalPages > 0 && $found == false);
|
||||
@@ -141,7 +141,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$search = new Search($request);
|
||||
$result = Invoice::search($search, null, $this->mockPPRestCall);
|
||||
$result = Invoice::search($search, null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertNotNull($result->getTotalCount());
|
||||
}
|
||||
@@ -155,7 +155,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$notification = new Notification($request);
|
||||
$result = $invoice->remind($notification, null, $this->mockPPRestCall);
|
||||
$result = $invoice->remind($notification, null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$notification = new CancelNotification($request);
|
||||
$result = $invoice->cancel($notification, null, $this->mockPPRestCall);
|
||||
$result = $invoice->cancel($notification, null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testQRCode($invoice)
|
||||
{
|
||||
$result = Invoice::qrCode($invoice->getId(), array(), null, $this->mockPPRestCall);
|
||||
$result = Invoice::qrCode($invoice->getId(), array(), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertNotNull($result->getImage());
|
||||
}
|
||||
@@ -198,7 +198,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$this->setupTest($this->getClassName(), 'testRecordPayment');
|
||||
$request = $this->operation['request']['body'];
|
||||
$paymentDetail = new PaymentDetail($request);
|
||||
$result = $invoice->recordPayment($paymentDetail, null, $this->mockPPRestCall);
|
||||
$result = $invoice->recordPayment($paymentDetail, null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
return $invoice;
|
||||
}
|
||||
@@ -213,7 +213,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$refundDetail = new RefundDetail($request);
|
||||
$result = $invoice->recordRefund($refundDetail, null, $this->mockPPRestCall);
|
||||
$result = $invoice->recordRefund($refundDetail, null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->setupTest($this->getClassName(), 'testDelete');
|
||||
$invoice = $this->testDelete($invoice);
|
||||
@@ -230,7 +230,7 @@ class InvoiceFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$this->setupTest($this->getClassName(), 'testCreate');
|
||||
$invoice = $this->testCreate($invoice);
|
||||
$this->setupTest($this->getClassName(), 'testDelete');
|
||||
$result = $invoice->delete(null, $this->mockPPRestCall);
|
||||
$result = $invoice->delete(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@ use PayPal\Api\Payment;
|
||||
use PayPal\Api\PaymentExecution;
|
||||
use PayPal\Api\Refund;
|
||||
use PayPal\Api\Sale;
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\CreateProfileResponse;
|
||||
use PayPal\Test\Functional\Setup;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\WebProfile;
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ class PaymentsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public $response;
|
||||
|
||||
public $mockPPRestCall;
|
||||
public $mockPayPalRestCall;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
@@ -57,7 +57,7 @@ class PaymentsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$obj = new Payment($request);
|
||||
$result = $obj->create(null, $this->mockPPRestCall);
|
||||
$result = $obj->create(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
return $result;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class PaymentsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$request = $this->operation['request']['body'];
|
||||
$obj = new Payment($request);
|
||||
$result = $obj->create(null, $this->mockPPRestCall);
|
||||
$result = $obj->create(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
return $result;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class PaymentsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($payment)
|
||||
{
|
||||
$result = Payment::get($payment->getId(), null, $this->mockPPRestCall);
|
||||
$result = Payment::get($payment->getId(), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($payment->getId(), $result->getId());
|
||||
$this->assertEquals($payment, $result, "", 0, 10, true);
|
||||
@@ -96,7 +96,7 @@ class PaymentsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$transaction = $transactions[0];
|
||||
$relatedResources = $transaction->getRelatedResources();
|
||||
$resource = $relatedResources[0];
|
||||
$result = Sale::get($resource->getSale()->getId(), null, $this->mockPPRestCall);
|
||||
$result = Sale::get($resource->getSale()->getId(), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($resource->getSale()->getId(), $result->getId());
|
||||
return $result;
|
||||
@@ -110,7 +110,7 @@ class PaymentsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
public function testRefundSale($sale)
|
||||
{
|
||||
$refund = new Refund($this->operation['request']['body']);
|
||||
$result = $sale->refund($refund, null, $this->mockPPRestCall);
|
||||
$result = $sale->refund($refund, null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals('completed', $result->getState());
|
||||
$this->assertEquals($sale->getId(), $result->getSaleId());
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
namespace PayPal\Test\Functional\Api;
|
||||
|
||||
use PayPal\Api\Patch;
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\CreateProfileResponse;
|
||||
use PayPal\Test\Functional\Setup;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\WebProfile;
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ class WebProfileFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public $response;
|
||||
|
||||
public $mockPPRestCall;
|
||||
public $mockPayPalRestCall;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
@@ -53,7 +53,7 @@ class WebProfileFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$request = $this->operation['request']['body'];
|
||||
$obj = new WebProfile($request);
|
||||
$obj->setName(uniqid());
|
||||
$result = $obj->create(null, $this->mockPPRestCall);
|
||||
$result = $obj->create(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
return $result;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class WebProfileFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($createProfileResponse)
|
||||
{
|
||||
$result = WebProfile::get($createProfileResponse->getId(), null, $this->mockPPRestCall);
|
||||
$result = WebProfile::get($createProfileResponse->getId(), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($createProfileResponse->getId(), $result->getId());
|
||||
$this->assertEquals($this->operation['response']['body']['presentation']['logo_image'], $result->getPresentation()->getLogoImage());
|
||||
@@ -82,7 +82,7 @@ class WebProfileFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetList($webProfile)
|
||||
{
|
||||
$result = WebProfile::get_list(null, $this->mockPPRestCall);
|
||||
$result = WebProfile::get_list(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$found = false;
|
||||
$foundObject = null;
|
||||
@@ -110,7 +110,7 @@ class WebProfileFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$boolValue = $webProfile->getInputFields()->getNoShipping();
|
||||
$newValue = ($boolValue + 1) % 2;
|
||||
$webProfile->getInputFields()->setNoShipping($newValue);
|
||||
$result = $webProfile->update(null, $this->mockPPRestCall);
|
||||
$result = $webProfile->update(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($webProfile->getInputFields()->getNoShipping(), $newValue);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class WebProfileFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
"path": "/flow_config/landing_page_type"
|
||||
|
||||
}');
|
||||
$result = $webProfile->partial_update($patches, null, $this->mockPPRestCall);
|
||||
$result = $webProfile->partial_update($patches, null, $this->mockPayPalRestCall);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class WebProfileFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$webProfile = new WebProfile();
|
||||
$webProfile->setId($createProfileResponse->getId());
|
||||
$result = $webProfile->delete(null, $this->mockPPRestCall);
|
||||
$result = $webProfile->delete(null, $this->mockPayPalRestCall);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@ use PayPal\Api\WebhookEventList;
|
||||
use PayPal\Api\WebhookEventType;
|
||||
use PayPal\Api\WebhookEventTypeList;
|
||||
use PayPal\Api\WebhookList;
|
||||
use PayPal\Common\PPModel;
|
||||
use PayPal\Exception\PPConnectionException;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Exception\PayPalConnectionException;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Rest\IResource;
|
||||
use PayPal\Api\CreateProfileResponse;
|
||||
use PayPal\Test\Functional\Setup;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Api\WebProfile;
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ class WebhookFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public $response;
|
||||
|
||||
public $mockPPRestCall;
|
||||
public $mockPayPalRestCall;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
@@ -68,12 +68,12 @@ class WebhookFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$obj->setUrl($obj->getUrl() . '?rand=' . uniqid());
|
||||
$result = null;
|
||||
try {
|
||||
$result = $obj->create(null, $this->mockPPRestCall);
|
||||
} catch (PPConnectionException $ex) {
|
||||
$result = $obj->create(null, $this->mockPayPalRestCall);
|
||||
} catch (PayPalConnectionException $ex) {
|
||||
$data = $ex->getData();
|
||||
if (strpos($data,'WEBHOOK_NUMBER_LIMIT_EXCEEDED') !== false) {
|
||||
$this->deleteAll();
|
||||
$result = $obj->create(null, $this->mockPPRestCall);
|
||||
$result = $obj->create(null, $this->mockPayPalRestCall);
|
||||
} else {
|
||||
$this->fail($ex->getMessage());
|
||||
}
|
||||
@@ -84,9 +84,9 @@ class WebhookFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function deleteAll()
|
||||
{
|
||||
$result = Webhook::getAll(null, $this->mockPPRestCall);
|
||||
$result = Webhook::getAll(null, $this->mockPayPalRestCall);
|
||||
foreach ($result->getWebhooks() as $webhookObject) {
|
||||
$webhookObject->delete(null, $this->mockPPRestCall);
|
||||
$webhookObject->delete(null, $this->mockPayPalRestCall);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class WebhookFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet($webhook)
|
||||
{
|
||||
$result = Webhook::get($webhook->getId(), null, $this->mockPPRestCall);
|
||||
$result = Webhook::get($webhook->getId(), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($webhook->getId(), $result->getId());
|
||||
$this->assertEquals($webhook, $result, "", 0, 10, true);
|
||||
@@ -111,7 +111,7 @@ class WebhookFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetSubscribedEventTypes($webhook)
|
||||
{
|
||||
$result = WebhookEventType::subscribedEventTypes($webhook->getId(), null, $this->mockPPRestCall);
|
||||
$result = WebhookEventType::subscribedEventTypes($webhook->getId(), null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals(2, sizeof($result->getEventTypes()));
|
||||
return $result;
|
||||
@@ -124,7 +124,7 @@ class WebhookFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetAll($webhook)
|
||||
{
|
||||
$result = Webhook::getAll(null, $this->mockPPRestCall);
|
||||
$result = Webhook::getAll(null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$found = false;
|
||||
$foundObject = null;
|
||||
@@ -162,7 +162,7 @@ class WebhookFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$patchRequest = new PatchRequest();
|
||||
$patchRequest->setPatches($patches);
|
||||
$result = $webhook->update($patchRequest, null, $this->mockPPRestCall);
|
||||
$result = $webhook->update($patchRequest, null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$found = false;
|
||||
$foundObject = null;
|
||||
@@ -181,13 +181,13 @@ class WebhookFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testDelete($webhook)
|
||||
{
|
||||
$result = $webhook->delete(null, $this->mockPPRestCall);
|
||||
$result = $webhook->delete(null, $this->mockPayPalRestCall);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testEventSearch()
|
||||
{
|
||||
$result = WebhookEvent::all(array(),null, $this->mockPPRestCall);
|
||||
$result = WebhookEvent::all(array(),null, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace PayPal\Test\Functional;
|
||||
|
||||
use PayPal\Auth\OAuthTokenCredential;
|
||||
use PayPal\Core\PPCredentialManager;
|
||||
use PayPal\Core\PayPalCredentialManager;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
class Setup
|
||||
@@ -24,7 +24,7 @@ class Setup
|
||||
'log.LogLevel' => 'FINE',
|
||||
'validation.level' => 'warning'
|
||||
));
|
||||
PPCredentialManager::getInstance()->setCredentialObject(
|
||||
PayPalCredentialManager::getInstance()->setCredentialObject(
|
||||
new OAuthTokenCredential(
|
||||
"AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS",
|
||||
"EGnHDxD_qRPdaLdZz8iCr8N7_MzF-YHPTkjs6NKYQvQSBngp4PTTVWkPZRbL"
|
||||
@@ -34,12 +34,12 @@ class Setup
|
||||
self::$mode = getenv('REST_MODE') ? getenv('REST_MODE') : 'mock';
|
||||
if (self::$mode != 'sandbox') {
|
||||
|
||||
// Mock PPRest Caller if mode set to mock
|
||||
$test->mockPPRestCall = $test->getMockBuilder('\PayPal\Transport\PPRestCall')
|
||||
// Mock PayPalRest Caller if mode set to mock
|
||||
$test->mockPayPalRestCall = $test->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$test->mockPPRestCall->expects($test->any())
|
||||
$test->mockPayPalRestCall->expects($test->any())
|
||||
->method('execute')
|
||||
->will($test->returnValue(
|
||||
$test->response
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Test class for PPAPIService.
|
||||
* Test class for ApiContextTest.
|
||||
*
|
||||
*/
|
||||
class ApiContextTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Validation;
|
||||
|
||||
use PayPal\Common\FormatConverter;
|
||||
use PayPal\Converter\FormatConverter;
|
||||
use PayPal\Validation\NumericValidator;
|
||||
|
||||
class NumericValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
Reference in New Issue
Block a user