Renaming Namespaces and Organizing Classes

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

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Address;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\AgreementStateDescriptor;
/**

View File

@@ -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);
}

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\AgreementTransaction;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\AgreementTransactions;
/**

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\BankAccountsList;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\BankToken;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\BillingInfo;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\CancelNotification;
/**

View File

@@ -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()
);

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\ChargeModel;
/**

View File

@@ -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;

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\CreateProfileResponse;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\CreditCardList;
/**

View File

@@ -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);
}

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\CreditCardToken;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Credit;
/**

View File

@@ -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;

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\CustomAmount;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\ErrorDetails;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Error;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\ExtendedBankAccount;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\FlowConfig;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\FundingInstrument;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\HyperSchema;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Image;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\InputFields;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\InvoiceAddress;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\InvoiceItem;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\InvoiceSearchResponse;
/**

View File

@@ -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);
}

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Links;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\MerchantInfo;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\MerchantPreferences;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Metadata;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Notification;
/**

View File

@@ -0,0 +1,52 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\OpenIdAddress;
/**
* Test class for OpenIdAddress.
*
*/
class OpenIdAddressTest extends \PHPUnit_Framework_TestCase
{
/** @var OpenIdAddress */
private $addr;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->addr = self::getTestData();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
public static function getTestData()
{
$addr = new OpenIdAddress();
$addr->setCountry("US")->setLocality("San Jose")
->setPostalCode("95112")->setRegion("CA")
->setStreetAddress("1, North 1'st street");
return $addr;
}
/**
* @test
*/
public function testSerializationDeserialization()
{
$addrCopy = new OpenIdAddress();
$addrCopy->fromJson($this->addr->toJson());
$this->assertEquals($this->addr, $addrCopy);
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\OpenIdError;
/**
* Test class for OpenIdError.
*
*/
class OpenIdErrorTest extends \PHPUnit_Framework_TestCase
{
/** @var OpenIdError */
private $error;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->error = new OpenIdError();
$this->error->setErrorDescription('error description')
->setErrorUri('http://developer.paypal.com/api/error')
->setError('VALIDATION_ERROR');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* @test
*/
public function testSerializationDeserialization()
{
$errorCopy = new OpenIdError();
$errorCopy->fromJson($this->error->toJson());
$this->assertEquals($this->error, $errorCopy);
}
}

View File

@@ -0,0 +1,96 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\OpenIdSession;
use PayPal\Rest\ApiContext;
/**
* Test class for OpenIdSession.
*
*/
class OpenIdSessionTest extends \PHPUnit_Framework_TestCase
{
private $context;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->context = new ApiContext();
$this->context->setConfig(
array(
'acct1.ClientId' => 'DummyId',
'acct1.ClientSecret' => 'A8VERY8SECRET8VALUE0',
'mode' => 'live'
)
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* @test
*/
public function testLoginUrlForMultipleScopes()
{
$clientId = "AQkquBDf1zctJOWGKWUEtKXm6qVhueUEMvXO_-MCI4DQQ4-LWvkDLIN2fGsd";
$redirectUri = 'https://devtools-paypal.com/';
$scope = array('this', 'that', 'and more');
$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),
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),
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),
OpenIdSession::getAuthorizationUrl($redirectUri, $scope, $clientId), "Failed case - openid scope");
}
/**
* @test
*/
public function testLoginWithCustomConfig()
{
$redirectUri = 'http://mywebsite.com';
$scope = array('this', 'that', 'and more');
$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),
OpenIdSession::getAuthorizationUrl($redirectUri, $scope, "DummyId", null, null, $this->context), "Failed case - custom config");
}
/**
* @test
*/
public function testLogoutWithCustomConfig()
{
$redirectUri = 'http://mywebsite.com';
$idToken = 'abc';
$expectedBaseUrl = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/endsession";
$this->assertEquals($expectedBaseUrl . "?id_token=$idToken&redirect_uri=" . urlencode($redirectUri) . "&logout=true",
OpenIdSession::getLogoutUrl($redirectUri, $idToken, $this->context), "Failed case - custom config");
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\OpenIdTokeninfo;
/**
* Test class for OpenIdTokeninfo.
*
*/
class OpenIdTokeninfoTest extends \PHPUnit_Framework_TestCase
{
/** @var OpenIdTokeninfo */
public $token;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->token = new OpenIdTokeninfo();
$this->token->setAccessToken("Access token")
->setExpiresIn(900)
->setRefreshToken("Refresh token")
->setIdToken("id token")
->setScope("openid address")
->setTokenType("Bearer");
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* @test
*/
public function testSerializationDeserialization()
{
$tokenCopy = new OpenIdTokeninfo();
$tokenCopy->fromJson($this->token->toJson());
$this->assertEquals($this->token, $tokenCopy);
}
/**
* @t1est
* TODO: Fix Test. This test is disabled
*/
public function t1estOperations()
{
$clientId = 'AQkquBDf1zctJOWGKWUEtKXm6qVhueUEMvXO_-MCI4DQQ4-LWvkDLIN2fGsd';
$clientSecret = 'ELtVxAjhT7cJimnz5-Nsx9k2reTKSVfErNQF-CmrwJgxRtylkGTKlU4RvrX';
$params = array(
'code' => '<FILLME>',
'redirect_uri' => 'https://devtools-paypal.com/',
'client_id' => $clientId,
'client_secret' => $clientSecret
);
$accessToken = OpenIdTokeninfo::createFromAuthorizationCode($params);
$this->assertNotNull($accessToken);
$params = array(
'refresh_token' => $accessToken->getRefreshToken(),
'client_id' => $clientId,
'client_secret' => $clientSecret
);
$accessToken = $accessToken->createFromRefreshToken($params);
$this->assertNotNull($accessToken);
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\OpenIdUserinfo;
/**
* Test class for OpenIdUserinfo.
*
*/
class OpenIdUserinfoTest extends \PHPUnit_Framework_TestCase
{
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* @test
*/
public function testSerializationDeserialization()
{
$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")
->setLocale("en-US")->setGender("male")->setName("John A Doe")
->setPayerId("A-XZASASA")->setPhoneNumber("1-408-111-1111")
->setPicture("http://gravatar.com/me.jpg")
->setSub("me@email.com")->setUserId("userId")
->setVerified(true)->setVerifiedAccount(true)
->setZoneinfo("America/PST")->setLanguage('en_US')
->setAddress(OpenIdAddressTest::getTestData());
$userCopy = new OpenIdUserinfo();
$userCopy->fromJson($user->toJSON());
$this->assertEquals($user, $userCopy);
}
/**
* @test
*/
public function testInvalidParamUserInfoCall()
{
$this->setExpectedException('PayPal\Exception\PayPalConnectionException');
OpenIdUserinfo::getUserinfo(array('access_token' => 'accessToken'));
}
}

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\OverrideChargeModel;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\PatchRequest;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Patch;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\PayerInfo;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Payer;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\PaymentCard;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\PaymentCardToken;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\PaymentDefinition;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\PaymentDetail;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\PaymentTerm;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Phone;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\PlanList;
/**

View File

@@ -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);
}

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Presentation;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\RefundDetail;
/**

View File

@@ -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
{

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Search;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\ShippingAddress;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\ShippingCost;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\ShippingInfo;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Tax;
/**

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\Terms;
/**

View File

@@ -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);
}

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\WebhookEventList;
/**

View File

@@ -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);
}

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\WebhookEventTypeList;
/**

View File

@@ -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);
}

View File

@@ -2,7 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\PayPalModel;
use PayPal\Api\WebhookList;
/**

View File

@@ -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);
}