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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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