recreate project

This commit is contained in:
root
2026-02-10 22:11:06 -05:00
commit 663c0cdbda
10149 changed files with 1379710 additions and 0 deletions
@@ -0,0 +1,75 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Address;
/**
* Class Address
*
* @package PayPal\Test\Api
*/
class AddressTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Address
*
* @return string
*/
public static function getJson()
{
return '{"line1":"TestSample","line2":"TestSample","city":"TestSample","country_code":"TestSample","postal_code":"TestSample","state":"TestSample","phone":"TestSample","normalization_status":"TestSample","status":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Address
*/
public static function getObject()
{
return new Address(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Address
*/
public function testSerializationDeserialization()
{
$obj = new Address(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getLine1());
$this->assertNotNull($obj->getLine2());
$this->assertNotNull($obj->getCity());
$this->assertNotNull($obj->getCountryCode());
$this->assertNotNull($obj->getPostalCode());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getPhone());
$this->assertNotNull($obj->getNormalizationStatus());
$this->assertNotNull($obj->getStatus());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Address $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getLine1(), "TestSample");
$this->assertEquals($obj->getLine2(), "TestSample");
$this->assertEquals($obj->getCity(), "TestSample");
$this->assertEquals($obj->getCountryCode(), "TestSample");
$this->assertEquals($obj->getPostalCode(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getPhone(), "TestSample");
$this->assertEquals($obj->getNormalizationStatus(), "TestSample");
$this->assertEquals($obj->getStatus(), "TestSample");
}
}
@@ -0,0 +1,57 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\AgreementStateDescriptor;
/**
* Class AgreementStateDescriptor
*
* @package PayPal\Test\Api
*/
class AgreementStateDescriptorTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object AgreementStateDescriptor
* @return string
*/
public static function getJson()
{
return '{"note":"TestSample","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return AgreementStateDescriptor
*/
public static function getObject()
{
return new AgreementStateDescriptor(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return AgreementStateDescriptor
*/
public function testSerializationDeserialization()
{
$obj = new AgreementStateDescriptor(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getNote());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param AgreementStateDescriptor $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getNote(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
}
@@ -0,0 +1,287 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Agreement;
/**
* Class Agreement
*
* @package PayPal\Test\Api
*/
class AgreementTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Agreement
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","state":"TestSample","name":"TestSample","description":"TestSample","start_date":"TestSample","payer":' .PayerTest::getJson() . ',"shipping_address":' .AddressTest::getJson() . ',"override_merchant_preferences":' .MerchantPreferencesTest::getJson() . ',"override_charge_models":' .OverrideChargeModelTest::getJson() . ',"plan":' .PlanTest::getJson() . ',"create_time":"TestSample","agreement_details":{"outstanding_balance":{"currency":"USD","value":"0.00"},"cycles_remaining":"12","cycles_completed":"0","next_billing_date":"2015-06-17T10:00:00Z","last_payment_date":"2015-03-18T20:20:17Z","last_payment_amount":{"currency":"USD","value":"1.00"},"final_payment_date":"2017-04-17T10:00:00Z","failed_payment_count":"0"},"update_time":"TestSample","links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return Agreement
*/
public static function getObject()
{
return new Agreement(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Agreement
*/
public function testSerializationDeserialization()
{
$obj = new Agreement(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getDescription());
$this->assertNotNull($obj->getStartDate());
$this->assertNotNull($obj->getPayer());
$this->assertNotNull($obj->getShippingAddress());
$this->assertNotNull($obj->getOverrideMerchantPreferences());
$this->assertNotNull($obj->getOverrideChargeModels());
$this->assertNotNull($obj->getPlan());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Agreement $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getDescription(), "TestSample");
$this->assertEquals($obj->getStartDate(), "TestSample");
$this->assertEquals($obj->getPayer(), PayerTest::getObject());
$this->assertEquals($obj->getShippingAddress(), AddressTest::getObject());
$this->assertEquals($obj->getOverrideMerchantPreferences(), MerchantPreferencesTest::getObject());
$this->assertEquals($obj->getOverrideChargeModels(), OverrideChargeModelTest::getObject());
$this->assertEquals($obj->getPlan(), PlanTest::getObject());
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testExecute($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->execute("123123", $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
AgreementTest::getJson()
));
$result = $obj->get("agreementId", $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$patchRequest = PatchRequestTest::getObject();
$result = $obj->update($patchRequest, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testSuspend($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->suspend($agreementStateDescriptor, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testReActivate($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->reActivate($agreementStateDescriptor, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testCancel($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->cancel($agreementStateDescriptor, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testBillBalance($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->billBalance($agreementStateDescriptor, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testSetBalance($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$currency = CurrencyTest::getObject();
$result = $obj->setBalance($currency, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testTransactions($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
AgreementTransactionsTest::getJson()
));
$result = $obj->searchTransactions("agreementId", array(), $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}
@@ -0,0 +1,73 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\AgreementTransaction;
/**
* Class AgreementTransaction
*
* @package PayPal\Test\Api
*/
class AgreementTransactionTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object AgreementTransaction
* @return string
*/
public static function getJson()
{
return '{"transaction_id":"TestSample","status":"TestSample","transaction_type":"TestSample","amount":' .CurrencyTest::getJson() . ',"fee_amount":' .CurrencyTest::getJson() . ',"net_amount":' .CurrencyTest::getJson() . ',"payer_email":"TestSample","payer_name":"TestSample","time_stamp":"TestSample","time_zone":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return AgreementTransaction
*/
public static function getObject()
{
return new AgreementTransaction(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return AgreementTransaction
*/
public function testSerializationDeserialization()
{
$obj = new AgreementTransaction(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getTransactionId());
$this->assertNotNull($obj->getStatus());
$this->assertNotNull($obj->getTransactionType());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getFeeAmount());
$this->assertNotNull($obj->getNetAmount());
$this->assertNotNull($obj->getPayerEmail());
$this->assertNotNull($obj->getPayerName());
$this->assertNotNull($obj->getTimeStamp());
$this->assertNotNull($obj->getTimeZone());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransaction $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getTransactionId(), "TestSample");
$this->assertEquals($obj->getStatus(), "TestSample");
$this->assertEquals($obj->getTransactionType(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getFeeAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getNetAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getPayerEmail(), "TestSample");
$this->assertEquals($obj->getPayerName(), "TestSample");
$this->assertEquals($obj->getTimeStamp(), "TestSample");
$this->assertEquals($obj->getTimeZone(), "TestSample");
}
}
@@ -0,0 +1,55 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\AgreementTransactions;
/**
* Class AgreementTransactions
*
* @package PayPal\Test\Api
*/
class AgreementTransactionsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object AgreementTransactions
* @return string
*/
public static function getJson()
{
return '{"agreement_transaction_list":' .AgreementTransactionTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return AgreementTransactions
*/
public static function getObject()
{
return new AgreementTransactions(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return AgreementTransactions
*/
public function testSerializationDeserialization()
{
$obj = new AgreementTransactions(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getAgreementTransactionList());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransactions $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getAgreementTransactionList(), AgreementTransactionTest::getObject());
}
}
@@ -0,0 +1,60 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\AlternatePayment;
/**
* Class AlternatePayment
*
* @package PayPal\Test\Api
*/
class AlternatePaymentTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object AlternatePayment
* @return string
*/
public static function getJson()
{
return '{"alternate_payment_account_id":"TestSample","external_customer_id":"TestSample","alternate_payment_provider_id":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return AlternatePayment
*/
public static function getObject()
{
return new AlternatePayment(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return AlternatePayment
*/
public function testSerializationDeserialization()
{
$obj = new AlternatePayment(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getAlternatePaymentAccountId());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getAlternatePaymentProviderId());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param AlternatePayment $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getAlternatePaymentAccountId(), "TestSample");
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getAlternatePaymentProviderId(), "TestSample");
}
}
@@ -0,0 +1,63 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Amount;
/**
* Class Amount
*
* @package PayPal\Test\Api
*/
class AmountTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Amount
*
* @return string
*/
public static function getJson()
{
return '{"currency":"TestSample","total":"12.34","details":' . DetailsTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Amount
*/
public static function getObject()
{
return new Amount(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Amount
*/
public function testSerializationDeserialization()
{
$obj = new Amount(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCurrency());
$this->assertNotNull($obj->getTotal());
$this->assertNotNull($obj->getDetails());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Amount $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCurrency(), "TestSample");
$this->assertEquals($obj->getTotal(), "12.34");
$this->assertEquals($obj->getDetails(), DetailsTest::getObject());
}
}
@@ -0,0 +1,177 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Authorization;
use PayPal\Transport\PPRestCall;
/**
* Class Authorization
*
* @package PayPal\Test\Api
*/
class AuthorizationTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Authorization
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","amount":' . AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","fmf_details":' . FmfDetailsTest::getJson() . ',"parent_payment":"TestSample","valid_until":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Authorization
*/
public static function getObject()
{
return new Authorization(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Authorization
*/
public function testSerializationDeserialization()
{
$obj = new Authorization(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getPaymentMode());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getReasonCode());
$this->assertNotNull($obj->getPendingReason());
$this->assertNotNull($obj->getProtectionEligibility());
$this->assertNotNull($obj->getProtectionEligibilityType());
$this->assertNotNull($obj->getFmfDetails());
$this->assertNotNull($obj->getParentPayment());
$this->assertNotNull($obj->getValidUntil());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Authorization $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getAmount(), AmountTest::getObject());
$this->assertEquals($obj->getPaymentMode(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getReasonCode(), "TestSample");
$this->assertEquals($obj->getPendingReason(), "TestSample");
$this->assertEquals($obj->getProtectionEligibility(), "TestSample");
$this->assertEquals($obj->getProtectionEligibilityType(), "TestSample");
$this->assertEquals($obj->getFmfDetails(), FmfDetailsTest::getObject());
$this->assertEquals($obj->getParentPayment(), "TestSample");
$this->assertEquals($obj->getValidUntil(), "TestSample");
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @dataProvider mockProvider
* @param Authorization $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
AuthorizationTest::getJson()
));
$result = $obj->get("authorizationId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Authorization $obj
*/
public function testCapture($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
CaptureTest::getJson()
));
$capture = CaptureTest::getObject();
$result = $obj->capture($capture, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Authorization $obj
*/
public function testVoid($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->void($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Authorization $obj
*/
public function testReauthorize($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->reauthorize($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}
@@ -0,0 +1,105 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\BankAccount;
/**
* Class BankAccount
*
* @package PayPal\Test\Api
*/
class BankAccountTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object BankAccount
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","account_number":"TestSample","account_number_type":"TestSample","routing_number":"TestSample","account_type":"TestSample","account_name":"TestSample","check_type":"TestSample","auth_type":"TestSample","auth_capture_timestamp":"TestSample","bank_name":"TestSample","country_code":"TestSample","first_name":"TestSample","last_name":"TestSample","birth_date":"TestSample","billing_address":' . AddressTest::getJson() . ',"state":"TestSample","confirmation_status":"TestSample","payer_id":"TestSample","external_customer_id":"TestSample","merchant_id":"TestSample","create_time":"TestSample","update_time":"TestSample","valid_until":"TestSample","links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return BankAccount
*/
public static function getObject()
{
return new BankAccount(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return BankAccount
*/
public function testSerializationDeserialization()
{
$obj = new BankAccount(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getAccountNumber());
$this->assertNotNull($obj->getAccountNumberType());
$this->assertNotNull($obj->getRoutingNumber());
$this->assertNotNull($obj->getAccountType());
$this->assertNotNull($obj->getAccountName());
$this->assertNotNull($obj->getCheckType());
$this->assertNotNull($obj->getAuthType());
$this->assertNotNull($obj->getAuthCaptureTimestamp());
$this->assertNotNull($obj->getBankName());
$this->assertNotNull($obj->getCountryCode());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getBirthDate());
$this->assertNotNull($obj->getBillingAddress());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getConfirmationStatus());
$this->assertNotNull($obj->getPayerId());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getMerchantId());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getValidUntil());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param BankAccount $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getAccountNumber(), "TestSample");
$this->assertEquals($obj->getAccountNumberType(), "TestSample");
$this->assertEquals($obj->getRoutingNumber(), "TestSample");
$this->assertEquals($obj->getAccountType(), "TestSample");
$this->assertEquals($obj->getAccountName(), "TestSample");
$this->assertEquals($obj->getCheckType(), "TestSample");
$this->assertEquals($obj->getAuthType(), "TestSample");
$this->assertEquals($obj->getAuthCaptureTimestamp(), "TestSample");
$this->assertEquals($obj->getBankName(), "TestSample");
$this->assertEquals($obj->getCountryCode(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getBirthDate(), "TestSample");
$this->assertEquals($obj->getBillingAddress(), AddressTest::getObject());
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getConfirmationStatus(), "TestSample");
$this->assertEquals($obj->getPayerId(), "TestSample");
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getMerchantId(), "TestSample");
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getValidUntil(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
}
@@ -0,0 +1,59 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\BankAccountsList;
/**
* Class BankAccountsList
*
* @package PayPal\Test\Api
*/
class BankAccountsListTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object BankAccountsList
* @return string
*/
public static function getJson()
{
return '{"bank-accounts":' .BankAccountTest::getJson() . ',"count":123,"next_id":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return BankAccountsList
*/
public static function getObject()
{
return new BankAccountsList(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return BankAccountsList
*/
public function testSerializationDeserialization()
{
$obj = new BankAccountsList(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getBankAccounts());
$this->assertNotNull($obj->getCount());
$this->assertNotNull($obj->getNextId());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param BankAccountsList $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getBankAccounts(), BankAccountTest::getObject());
$this->assertEquals($obj->getCount(), 123);
$this->assertEquals($obj->getNextId(), "TestSample");
}
}
@@ -0,0 +1,63 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\BankToken;
/**
* Class BankToken
*
* @package PayPal\Test\Api
*/
class BankTokenTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object BankToken
*
* @return string
*/
public static function getJson()
{
return '{"bank_id":"TestSample","external_customer_id":"TestSample","mandate_reference_number":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return BankToken
*/
public static function getObject()
{
return new BankToken(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return BankToken
*/
public function testSerializationDeserialization()
{
$obj = new BankToken(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getBankId());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getMandateReferenceNumber());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param BankToken $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getBankId(), "TestSample");
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getMandateReferenceNumber(), "TestSample");
}
}
@@ -0,0 +1,71 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\BillingInfo;
/**
* Class BillingInfo
*
* @package PayPal\Test\Api
*/
class BillingInfoTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object BillingInfo
* @return string
*/
public static function getJson()
{
return '{"email":"TestSample","first_name":"TestSample","last_name":"TestSample","business_name":"TestSample","address":' .InvoiceAddressTest::getJson() . ',"language":"TestSample","additional_info":"TestSample","notification_channel":"TestSample","phone":' .PhoneTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return BillingInfo
*/
public static function getObject()
{
return new BillingInfo(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return BillingInfo
*/
public function testSerializationDeserialization()
{
$obj = new BillingInfo(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getEmail());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getBusinessName());
$this->assertNotNull($obj->getAddress());
$this->assertNotNull($obj->getLanguage());
$this->assertNotNull($obj->getAdditionalInfo());
$this->assertNotNull($obj->getNotificationChannel());
$this->assertNotNull($obj->getPhone());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param BillingInfo $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getEmail(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getBusinessName(), "TestSample");
$this->assertEquals($obj->getAddress(), InvoiceAddressTest::getObject());
$this->assertEquals($obj->getLanguage(), "TestSample");
$this->assertEquals($obj->getAdditionalInfo(), "TestSample");
$this->assertEquals($obj->getNotificationChannel(), "TestSample");
$this->assertEquals($obj->getPhone(), PhoneTest::getObject());
}
}
@@ -0,0 +1,56 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Billing;
/**
* Class Billing
*
* @package PayPal\Test\Api
*/
class BillingTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Billing
* @return string
*/
public static function getJson()
{
return '{"billing_agreement_id":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Billing
*/
public static function getObject()
{
return new Billing(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Billing
*/
public function testSerializationDeserialization()
{
$obj = new Billing(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getBillingAgreementId());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Billing $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getBillingAgreementId(), "TestSample");
}
}
@@ -0,0 +1,61 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CancelNotification;
/**
* Class CancelNotification
*
* @package PayPal\Test\Api
*/
class CancelNotificationTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CancelNotification
* @return string
*/
public static function getJson()
{
return '{"subject":"TestSample","note":"TestSample","send_to_merchant":true,"send_to_payer":true}';
}
/**
* Gets Object Instance with Json data filled in
* @return CancelNotification
*/
public static function getObject()
{
return new CancelNotification(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return CancelNotification
*/
public function testSerializationDeserialization()
{
$obj = new CancelNotification(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getSubject());
$this->assertNotNull($obj->getNote());
$this->assertNotNull($obj->getSendToMerchant());
$this->assertNotNull($obj->getSendToPayer());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CancelNotification $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getSubject(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
$this->assertEquals($obj->getSendToMerchant(), true);
$this->assertEquals($obj->getSendToPayer(), true);
}
}
@@ -0,0 +1,127 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Capture;
use PayPal\Transport\PPRestCall;
/**
* Class Capture
*
* @package PayPal\Test\Api
*/
class CaptureTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Capture
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","amount":' . AmountTest::getJson() . ',"is_final_capture":true,"state":"TestSample","parent_payment":"TestSample","transaction_fee":' . CurrencyTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Capture
*/
public static function getObject()
{
return new Capture(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Capture
*/
public function testSerializationDeserialization()
{
$obj = new Capture(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getIsFinalCapture());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getParentPayment());
$this->assertNotNull($obj->getTransactionFee());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Capture $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getAmount(), AmountTest::getObject());
$this->assertEquals($obj->getIsFinalCapture(), true);
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getParentPayment(), "TestSample");
$this->assertEquals($obj->getTransactionFee(), CurrencyTest::getObject());
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @dataProvider mockProvider
* @param Capture $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
CaptureTest::getJson()
));
$result = $obj->get("captureId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Capture $obj
*/
public function testRefund($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
RefundTest::getJson()
));
$refund = RefundTest::getObject();
$result = $obj->refund($refund, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}
@@ -0,0 +1,64 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CarrierAccount;
/**
* Class CarrierAccount
*
* @package PayPal\Test\Api
*/
class CarrierAccountTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CarrierAccount
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","phone_number":"TestSample","external_customer_id":"TestSample","phone_source":"TestSample","country_code":' .CountryCodeTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return CarrierAccount
*/
public static function getObject()
{
return new CarrierAccount(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return CarrierAccount
*/
public function testSerializationDeserialization()
{
$obj = new CarrierAccount(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getPhoneNumber());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getPhoneSource());
$this->assertNotNull($obj->getCountryCode());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CarrierAccount $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getPhoneNumber(), "TestSample");
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getPhoneSource(), "TestSample");
$this->assertEquals($obj->getCountryCode(), CountryCodeTest::getObject());
}
}
@@ -0,0 +1,61 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CarrierAccountToken;
/**
* Class CarrierAccountToken
*
* @package PayPal\Test\Api
*/
class CarrierAccountTokenTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CarrierAccountToken
*
* @return string
*/
public static function getJson()
{
return '{"carrier_account_id":"TestSample","external_customer_id":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return CarrierAccountToken
*/
public static function getObject()
{
return new CarrierAccountToken(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return CarrierAccountToken
*/
public function testSerializationDeserialization()
{
$obj = new CarrierAccountToken(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCarrierAccountId());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CarrierAccountToken $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCarrierAccountId(), "TestSample");
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
}
}
@@ -0,0 +1,104 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CartBase;
/**
* Class CartBase
*
* @package PayPal\Test\Api
*/
class CartBaseTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CartBase
*
* @return string
*/
public static function getJson()
{
return '{"reference_id":"TestSample","amount":' . AmountTest::getJson() . ',"payee":' . PayeeTest::getJson() . ',"description":"TestSample","note_to_payee":"TestSample","custom":"TestSample","invoice_number":"TestSample","soft_descriptor":"TestSample","soft_descriptor_city":"TestSample","payment_options":' . PaymentOptionsTest::getJson() . ',"item_list":' . ItemListTest::getJson() . ',"notify_url":"http://www.google.com","order_url":"http://www.google.com","external_funding":' . ExternalFundingTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return CartBase
*/
public static function getObject()
{
return new CartBase(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return CartBase
*/
public function testSerializationDeserialization()
{
$obj = new CartBase(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getReferenceId());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getPayee());
$this->assertNotNull($obj->getDescription());
$this->assertNotNull($obj->getNoteToPayee());
$this->assertNotNull($obj->getCustom());
$this->assertNotNull($obj->getInvoiceNumber());
$this->assertNotNull($obj->getSoftDescriptor());
$this->assertNotNull($obj->getSoftDescriptorCity());
$this->assertNotNull($obj->getPaymentOptions());
$this->assertNotNull($obj->getItemList());
$this->assertNotNull($obj->getNotifyUrl());
$this->assertNotNull($obj->getOrderUrl());
$this->assertNotNull($obj->getExternalFunding());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CartBase $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getReferenceId(), "TestSample");
$this->assertEquals($obj->getAmount(), AmountTest::getObject());
$this->assertEquals($obj->getPayee(), PayeeTest::getObject());
$this->assertEquals($obj->getDescription(), "TestSample");
$this->assertEquals($obj->getNoteToPayee(), "TestSample");
$this->assertEquals($obj->getCustom(), "TestSample");
$this->assertEquals($obj->getInvoiceNumber(), "TestSample");
$this->assertEquals($obj->getSoftDescriptor(), "TestSample");
$this->assertEquals($obj->getSoftDescriptorCity(), "TestSample");
$this->assertEquals($obj->getPaymentOptions(), PaymentOptionsTest::getObject());
$this->assertEquals($obj->getItemList(), ItemListTest::getObject());
$this->assertEquals($obj->getNotifyUrl(), "http://www.google.com");
$this->assertEquals($obj->getOrderUrl(), "http://www.google.com");
$this->assertEquals($obj->getExternalFunding(), ExternalFundingTest::getObject());
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage NotifyUrl is not a fully qualified URL
*/
public function testUrlValidationForNotifyUrl()
{
$obj = new CartBase();
$obj->setNotifyUrl(null);
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage OrderUrl is not a fully qualified URL
*/
public function testUrlValidationForOrderUrl()
{
$obj = new CartBase();
$obj->setOrderUrl(null);
}
}
@@ -0,0 +1,59 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\ChargeModel;
/**
* Class ChargeModel
*
* @package PayPal\Test\Api
*/
class ChargeModelTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object ChargeModels
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","type":"TestSample","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return ChargeModel
*/
public static function getObject()
{
return new ChargeModel(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return ChargeModel
*/
public function testSerializationDeserialization()
{
$obj = new ChargeModel(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param ChargeModel $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
}
@@ -0,0 +1,57 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Cost;
/**
* Class Cost
*
* @package PayPal\Test\Api
*/
class CostTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Cost
* @return string
*/
public static function getJson()
{
return '{"percent":"12.34","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return Cost
*/
public static function getObject()
{
return new Cost(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Cost
*/
public function testSerializationDeserialization()
{
$obj = new Cost(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPercent());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Cost $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPercent(), "12.34");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
}
@@ -0,0 +1,56 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CountryCode;
/**
* Class CountryCode
*
* @package PayPal\Test\Api
*/
class CountryCodeTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CountryCode
* @return string
*/
public static function getJson()
{
return '{"country_code":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return CountryCode
*/
public static function getObject()
{
return new CountryCode(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return CountryCode
*/
public function testSerializationDeserialization()
{
$obj = new CountryCode(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCountryCode());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CountryCode $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCountryCode(), "TestSample");
}
}
@@ -0,0 +1,55 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CreateProfileResponse;
/**
* Class CreateProfileResponse
*
* @package PayPal\Test\Api
*/
class CreateProfileResponseTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CreateProfileResponse
* @return string
*/
public static function getJson()
{
return json_encode(json_decode('{"id":"TestSample"}'));
}
/**
* Gets Object Instance with Json data filled in
* @return CreateProfileResponse
*/
public static function getObject()
{
return new CreateProfileResponse(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return CreateProfileResponse
*/
public function testSerializationDeserialization()
{
$obj = new CreateProfileResponse(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CreateProfileResponse $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
}
}
@@ -0,0 +1,73 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CreditCard;
use PayPal\Api\CreditCardHistory;
class CreditCardHistoryTest extends \PHPUnit_Framework_TestCase
{
private $cards;
public static $id = "id";
public static $validUntil = "2013-02-28T00:00:00Z";
public static $state = "created";
public static $payerId = "payer-id";
public static $cardType = "visa";
public static $cardNumber = "4417119669820331";
public static $expireMonth = 11;
public static $expireYear = "2019";
public static $cvv = "012";
public static $firstName = "V";
public static $lastName = "C";
public static function createCreditCard()
{
$card = new CreditCard();
$card->setType(self::$cardType);
$card->setNumber(self::$cardNumber);
$card->setExpireMonth(self::$expireMonth);
$card->setExpireYear(self::$expireYear);
$card->setCvv2(self::$cvv);
$card->setFirstName(self::$firstName);
$card->setLastName(self::$lastName);
$card->setId(self::$id);
$card->setValidUntil(self::$validUntil);
$card->setState(self::$state);
return $card;
}
public function setup()
{
$card = self::createCreditCard();
$card->setBillingAddress(AddressTest::getObject());
$card->setLinks(array(LinksTest::getObject()));
$this->cards['full'] = $card;
$card = self::createCreditCard();
$this->cards['partial'] = $card;
}
public function testGetterSetters()
{
$cardHistory = new CreditCardHistory();
$cardHistory->setCreditCards(array($this->cards['partial'], $this->cards['full']));
$cardHistory->setCount(2);
$this->assertEquals(2, count($cardHistory->getCreditCards()));
}
public function testSerializationDeserialization()
{
$cardHistory = new CreditCardHistory();
$cardHistory->setCreditCards(array($this->cards['partial'], $this->cards['full']));
$cardHistory->setCount(2);
$cardHistoryCopy = new CreditCardHistory();
$cardHistoryCopy->fromJson($cardHistory->toJSON());
$this->assertEquals($cardHistory, $cardHistoryCopy);
}
}
@@ -0,0 +1,61 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CreditCardList;
/**
* Class CreditCardList
*
* @package PayPal\Test\Api
*/
class CreditCardListTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CreditCardList
* @return string
*/
public static function getJson()
{
return '{"items":' .CreditCardTest::getJson() . ',"links":' .LinksTest::getJson() . ',"total_items":123,"total_pages":123}';
}
/**
* Gets Object Instance with Json data filled in
* @return CreditCardList
*/
public static function getObject()
{
return new CreditCardList(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return CreditCardList
*/
public function testSerializationDeserialization()
{
$obj = new CreditCardList(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getItems());
$this->assertNotNull($obj->getLinks());
$this->assertNotNull($obj->getTotalItems());
$this->assertNotNull($obj->getTotalPages());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CreditCardList $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getItems(), CreditCardTest::getObject());
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
$this->assertEquals($obj->getTotalItems(), 123);
$this->assertEquals($obj->getTotalPages(), 123);
}
}
@@ -0,0 +1,83 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CreditCard;
/**
* Class CreditCard
*
* @package PayPal\Test\Api
*/
class CreditCardTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CreditCard
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"cvv2":"TestSample","first_name":"TestSample","last_name":"TestSample","billing_address":' . AddressTest::getJson() . ',"external_customer_id":"TestSample","state":"TestSample","valid_until":"TestSample","links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return CreditCard
*/
public static function getObject()
{
return new CreditCard(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return CreditCard
*/
public function testSerializationDeserialization()
{
$obj = new CreditCard(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getNumber());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getExpireMonth());
$this->assertNotNull($obj->getExpireYear());
$this->assertNotNull($obj->getCvv2());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getBillingAddress());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getValidUntil());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CreditCard $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getNumber(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getExpireMonth(), 123);
$this->assertEquals($obj->getExpireYear(), 123);
$this->assertEquals($obj->getCvv2(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getBillingAddress(), AddressTest::getObject());
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getValidUntil(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
}
@@ -0,0 +1,69 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CreditCardToken;
/**
* Class CreditCardToken
*
* @package PayPal\Test\Api
*/
class CreditCardTokenTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CreditCardToken
*
* @return string
*/
public static function getJson()
{
return '{"credit_card_id":"TestSample","payer_id":"TestSample","last4":"TestSample","type":"TestSample","expire_month":123,"expire_year":123}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return CreditCardToken
*/
public static function getObject()
{
return new CreditCardToken(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return CreditCardToken
*/
public function testSerializationDeserialization()
{
$obj = new CreditCardToken(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCreditCardId());
$this->assertNotNull($obj->getPayerId());
$this->assertNotNull($obj->getLast4());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getExpireMonth());
$this->assertNotNull($obj->getExpireYear());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CreditCardToken $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCreditCardId(), "TestSample");
$this->assertEquals($obj->getPayerId(), "TestSample");
$this->assertEquals($obj->getLast4(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getExpireMonth(), 123);
$this->assertEquals($obj->getExpireYear(), 123);
}
}
@@ -0,0 +1,66 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CreditFinancingOffered;
/**
* Class CreditFinancingOffered
*
* @package PayPal\Test\Api
*/
class CreditFinancingOfferedTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CreditFinancingOffered
* @return string
*/
public static function getJson()
{
return '{"total_cost":' .CurrencyTest::getJson() . ',"term":"12.34","monthly_payment":' .CurrencyTest::getJson() . ',"total_interest":' .CurrencyTest::getJson() . ',"payer_acceptance":true,"cart_amount_immutable":true}';
}
/**
* Gets Object Instance with Json data filled in
* @return CreditFinancingOffered
*/
public static function getObject()
{
return new CreditFinancingOffered(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return CreditFinancingOffered
*/
public function testSerializationDeserialization()
{
$obj = new CreditFinancingOffered(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getTotalCost());
$this->assertNotNull($obj->getTerm());
$this->assertNotNull($obj->getMonthlyPayment());
$this->assertNotNull($obj->getTotalInterest());
$this->assertNotNull($obj->getPayerAcceptance());
$this->assertNotNull($obj->getCartAmountImmutable());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CreditFinancingOffered $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getTotalCost(), CurrencyTest::getObject());
$this->assertEquals($obj->getTerm(), "12.34");
$this->assertEquals($obj->getMonthlyPayment(), CurrencyTest::getObject());
$this->assertEquals($obj->getTotalInterest(), CurrencyTest::getObject());
$this->assertEquals($obj->getPayerAcceptance(), true);
$this->assertEquals($obj->getCartAmountImmutable(), true);
}
}
@@ -0,0 +1,61 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Credit;
/**
* Class Credit
*
* @package PayPal\Test\Api
*/
class CreditTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Credit
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","type":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Credit
*/
public static function getObject()
{
return new Credit(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Credit
*/
public function testSerializationDeserialization()
{
$obj = new Credit(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getType());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Credit $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
}
}
@@ -0,0 +1,91 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CurrencyConversion;
/**
* Class CurrencyConversion
*
* @package PayPal\Test\Api
*/
class CurrencyConversionTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CurrencyConversion
*
* @return string
*/
public static function getJson()
{
return '{"conversion_date":"TestSample","from_currency":"TestSample","from_amount":"TestSample","to_currency":"TestSample","to_amount":"TestSample","conversion_type":"TestSample","conversion_type_changeable":true,"web_url":"http://www.google.com","links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return CurrencyConversion
*/
public static function getObject()
{
return new CurrencyConversion(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return CurrencyConversion
*/
public function testSerializationDeserialization()
{
$obj = new CurrencyConversion(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getConversionDate());
$this->assertNotNull($obj->getFromCurrency());
$this->assertNotNull($obj->getFromAmount());
$this->assertNotNull($obj->getToCurrency());
$this->assertNotNull($obj->getToAmount());
$this->assertNotNull($obj->getConversionType());
$this->assertNotNull($obj->getConversionTypeChangeable());
$this->assertNotNull($obj->getWebUrl());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CurrencyConversion $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getConversionDate(), "TestSample");
$this->assertEquals($obj->getFromCurrency(), "TestSample");
$this->assertEquals($obj->getFromAmount(), "TestSample");
$this->assertEquals($obj->getToCurrency(), "TestSample");
$this->assertEquals($obj->getToAmount(), "TestSample");
$this->assertEquals($obj->getConversionType(), "TestSample");
$this->assertEquals($obj->getConversionTypeChangeable(), true);
$this->assertEquals($obj->getWebUrl(), "http://www.google.com");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage WebUrl is not a fully qualified URL
*/
public function testUrlValidationForWebUrl()
{
$obj = new CurrencyConversion();
$obj->setWebUrl(null);
}
public function testUrlValidationForWebUrlDeprecated()
{
$obj = new CurrencyConversion();
$obj->setWebUrl(null);
$this->assertNull($obj->getWebUrl());
}
}
@@ -0,0 +1,61 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Currency;
/**
* Class Currency
*
* @package PayPal\Test\Api
*/
class CurrencyTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Currency
*
* @return string
*/
public static function getJson()
{
return '{"currency":"TestSample","value":"12.34"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Currency
*/
public static function getObject()
{
return new Currency(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Currency
*/
public function testSerializationDeserialization()
{
$obj = new Currency(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCurrency());
$this->assertNotNull($obj->getValue());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Currency $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCurrency(), "TestSample");
$this->assertEquals($obj->getValue(), "12.34");
}
}
@@ -0,0 +1,57 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\CustomAmount;
/**
* Class CustomAmount
*
* @package PayPal\Test\Api
*/
class CustomAmountTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CustomAmount
* @return string
*/
public static function getJson()
{
return '{"label":"TestSample","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return CustomAmount
*/
public static function getObject()
{
return new CustomAmount(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return CustomAmount
*/
public function testSerializationDeserialization()
{
$obj = new CustomAmount(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getLabel());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CustomAmount $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getLabel(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
}
@@ -0,0 +1,73 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Details;
/**
* Class Details
*
* @package PayPal\Test\Api
*/
class DetailsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Details
*
* @return string
*/
public static function getJson()
{
return '{"subtotal":"12.34","shipping":"12.34","tax":"12.34","handling_fee":"12.34","shipping_discount":"12.34","insurance":"12.34","gift_wrap":"12.34","fee":"12.34"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Details
*/
public static function getObject()
{
return new Details(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Details
*/
public function testSerializationDeserialization()
{
$obj = new Details(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getSubtotal());
$this->assertNotNull($obj->getShipping());
$this->assertNotNull($obj->getTax());
$this->assertNotNull($obj->getHandlingFee());
$this->assertNotNull($obj->getShippingDiscount());
$this->assertNotNull($obj->getInsurance());
$this->assertNotNull($obj->getGiftWrap());
$this->assertNotNull($obj->getFee());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Details $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getSubtotal(), "12.34");
$this->assertEquals($obj->getShipping(), "12.34");
$this->assertEquals($obj->getTax(), "12.34");
$this->assertEquals($obj->getHandlingFee(), "12.34");
$this->assertEquals($obj->getShippingDiscount(), "12.34");
$this->assertEquals($obj->getInsurance(), "12.34");
$this->assertEquals($obj->getGiftWrap(), "12.34");
$this->assertEquals($obj->getFee(), "12.34");
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\ErrorDetails;
/**
* Class ErrorDetails
*
* @package PayPal\Test\Api
*/
class ErrorDetailsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object ErrorDetails
*
* @return string
*/
public static function getJson()
{
return '{"field":"TestSample","issue":"TestSample","purchase_unit_reference_id":"TestSample","code":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return ErrorDetails
*/
public static function getObject()
{
return new ErrorDetails(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return ErrorDetails
*/
public function testSerializationDeserialization()
{
$obj = new ErrorDetails(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getField());
$this->assertNotNull($obj->getIssue());
$this->assertNotNull($obj->getPurchaseUnitReferenceId());
$this->assertNotNull($obj->getCode());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param ErrorDetails $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getField(), "TestSample");
$this->assertEquals($obj->getIssue(), "TestSample");
$this->assertEquals($obj->getPurchaseUnitReferenceId(), "TestSample");
$this->assertEquals($obj->getCode(), "TestSample");
}
}
@@ -0,0 +1,77 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Error;
/**
* Class Error
*
* @package PayPal\Test\Api
*/
class ErrorTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Error
*
* @return string
*/
public static function getJson()
{
return '{"name":"TestSample","purchase_unit_reference_id":"TestSample","message":"TestSample","code":"TestSample","details":' . ErrorDetailsTest::getJson() . ',"processor_response":' . ProcessorResponseTest::getJson() . ',"fmf_details":' . FmfDetailsTest::getJson() . ',"information_link":"TestSample","debug_id":"TestSample","links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Error
*/
public static function getObject()
{
return new Error(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Error
*/
public function testSerializationDeserialization()
{
$obj = new Error(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getPurchaseUnitReferenceId());
$this->assertNotNull($obj->getMessage());
$this->assertNotNull($obj->getCode());
$this->assertNotNull($obj->getDetails());
$this->assertNotNull($obj->getProcessorResponse());
$this->assertNotNull($obj->getFmfDetails());
$this->assertNotNull($obj->getInformationLink());
$this->assertNotNull($obj->getDebugId());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Error $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getPurchaseUnitReferenceId(), "TestSample");
$this->assertEquals($obj->getMessage(), "TestSample");
$this->assertEquals($obj->getCode(), "TestSample");
$this->assertEquals($obj->getDetails(), ErrorDetailsTest::getObject());
$this->assertEquals($obj->getProcessorResponse(), ProcessorResponseTest::getObject());
$this->assertEquals($obj->getFmfDetails(), FmfDetailsTest::getObject());
$this->assertEquals($obj->getInformationLink(), "TestSample");
$this->assertEquals($obj->getDebugId(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
}
@@ -0,0 +1,59 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\ExtendedBankAccount;
/**
* Class ExtendedBankAccount
*
* @package PayPal\Test\Api
*/
class ExtendedBankAccountTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object ExtendedBankAccount
*
* @return string
*/
public static function getJson()
{
return '{"mandate_reference_number":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return ExtendedBankAccount
*/
public static function getObject()
{
return new ExtendedBankAccount(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return ExtendedBankAccount
*/
public function testSerializationDeserialization()
{
$obj = new ExtendedBankAccount(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getMandateReferenceNumber());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param ExtendedBankAccount $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getMandateReferenceNumber(), "TestSample");
}
}
@@ -0,0 +1,64 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\ExternalFunding;
/**
* Class ExternalFunding
*
* @package PayPal\Test\Api
*/
class ExternalFundingTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object ExternalFunding
* @return string
*/
public static function getJson()
{
return '{"reference_id":"TestSample","code":"TestSample","funding_account_id":"TestSample","display_text":"TestSample","amount":' .AmountTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return ExternalFunding
*/
public static function getObject()
{
return new ExternalFunding(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return ExternalFunding
*/
public function testSerializationDeserialization()
{
$obj = new ExternalFunding(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getReferenceId());
$this->assertNotNull($obj->getCode());
$this->assertNotNull($obj->getFundingAccountId());
$this->assertNotNull($obj->getDisplayText());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param ExternalFunding $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getReferenceId(), "TestSample");
$this->assertEquals($obj->getCode(), "TestSample");
$this->assertEquals($obj->getFundingAccountId(), "TestSample");
$this->assertEquals($obj->getDisplayText(), "TestSample");
$this->assertEquals($obj->getAmount(), AmountTest::getObject());
}
}
@@ -0,0 +1,67 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\FlowConfig;
/**
* Class FlowConfig
*
* @package PayPal\Test\Api
*/
class FlowConfigTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object FlowConfig
* @return string
*/
public static function getJson()
{
return '{"landing_page_type":"TestSample","bank_txn_pending_url":"http://www.google.com"}';
}
/**
* Gets Object Instance with Json data filled in
* @return FlowConfig
*/
public static function getObject()
{
return new FlowConfig(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return FlowConfig
*/
public function testSerializationDeserialization()
{
$obj = new FlowConfig(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getLandingPageType());
$this->assertNotNull($obj->getBankTxnPendingUrl());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param FlowConfig $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getLandingPageType(), "TestSample");
$this->assertEquals($obj->getBankTxnPendingUrl(), "http://www.google.com");
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage BankTxnPendingUrl is not a fully qualified URL
*/
public function testUrlValidationForBankTxnPendingUrl()
{
$obj = new FlowConfig();
$obj->setBankTxnPendingUrl(null);
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\FmfDetails;
/**
* Class FmfDetails
*
* @package PayPal\Test\Api
*/
class FmfDetailsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object FmfDetails
*
* @return string
*/
public static function getJson()
{
return '{"filter_type":"TestSample","filter_id":"TestSample","name":"TestSample","description":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return FmfDetails
*/
public static function getObject()
{
return new FmfDetails(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return FmfDetails
*/
public function testSerializationDeserialization()
{
$obj = new FmfDetails(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getFilterType());
$this->assertNotNull($obj->getFilterId());
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getDescription());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param FmfDetails $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getFilterType(), "TestSample");
$this->assertEquals($obj->getFilterId(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getDescription(), "TestSample");
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\FundingDetail;
/**
* Class FundingDetail
*
* @package PayPal\Test\Api
*/
class FundingDetailTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object FundingDetail
*
* @return string
*/
public static function getJson()
{
return '{"clearing_time":"TestSample","payment_hold_date":"TestSample","payment_debit_date":"TestSample","processing_type":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return FundingDetail
*/
public static function getObject()
{
return new FundingDetail(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return FundingDetail
*/
public function testSerializationDeserialization()
{
$obj = new FundingDetail(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getClearingTime());
$this->assertNotNull($obj->getPaymentHoldDate());
$this->assertNotNull($obj->getPaymentDebitDate());
$this->assertNotNull($obj->getProcessingType());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param FundingDetail $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getClearingTime(), "TestSample");
$this->assertEquals($obj->getPaymentHoldDate(), "TestSample");
$this->assertEquals($obj->getPaymentDebitDate(), "TestSample");
$this->assertEquals($obj->getProcessingType(), "TestSample");
}
}
@@ -0,0 +1,83 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\FundingInstrument;
/**
* Class FundingInstrument
*
* @package PayPal\Test\Api
*/
class FundingInstrumentTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object FundingInstrument
*
* @return string
*/
public static function getJson()
{
return '{"credit_card":' . CreditCardTest::getJson() . ',"credit_card_token":' . CreditCardTokenTest::getJson() . ',"payment_card":' . PaymentCardTest::getJson() . ',"bank_account":' . ExtendedBankAccountTest::getJson() . ',"bank_account_token":' . BankTokenTest::getJson() . ',"credit":' . CreditTest::getJson() . ',"incentive":' . IncentiveTest::getJson() . ',"external_funding":' . ExternalFundingTest::getJson() . ',"carrier_account_token":' . CarrierAccountTokenTest::getJson() . ',"carrier_account":' . CarrierAccountTest::getJson() . ',"private_label_card":' . PrivateLabelCardTest::getJson() . ',"billing":' . BillingTest::getJson() . ',"alternate_payment":' . AlternatePaymentTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return FundingInstrument
*/
public static function getObject()
{
return new FundingInstrument(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return FundingInstrument
*/
public function testSerializationDeserialization()
{
$obj = new FundingInstrument(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCreditCard());
$this->assertNotNull($obj->getCreditCardToken());
$this->assertNotNull($obj->getPaymentCard());
$this->assertNotNull($obj->getBankAccount());
$this->assertNotNull($obj->getBankAccountToken());
$this->assertNotNull($obj->getCredit());
$this->assertNotNull($obj->getIncentive());
$this->assertNotNull($obj->getExternalFunding());
$this->assertNotNull($obj->getCarrierAccountToken());
$this->assertNotNull($obj->getCarrierAccount());
$this->assertNotNull($obj->getPrivateLabelCard());
$this->assertNotNull($obj->getBilling());
$this->assertNotNull($obj->getAlternatePayment());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param FundingInstrument $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCreditCard(), CreditCardTest::getObject());
$this->assertEquals($obj->getCreditCardToken(), CreditCardTokenTest::getObject());
$this->assertEquals($obj->getPaymentCard(), PaymentCardTest::getObject());
$this->assertEquals($obj->getBankAccount(), ExtendedBankAccountTest::getObject());
$this->assertEquals($obj->getBankAccountToken(), BankTokenTest::getObject());
$this->assertEquals($obj->getCredit(), CreditTest::getObject());
$this->assertEquals($obj->getIncentive(), IncentiveTest::getObject());
$this->assertEquals($obj->getExternalFunding(), ExternalFundingTest::getObject());
$this->assertEquals($obj->getCarrierAccountToken(), CarrierAccountTokenTest::getObject());
$this->assertEquals($obj->getCarrierAccount(), CarrierAccountTest::getObject());
$this->assertEquals($obj->getPrivateLabelCard(), PrivateLabelCardTest::getObject());
$this->assertEquals($obj->getBilling(), BillingTest::getObject());
$this->assertEquals($obj->getAlternatePayment(), AlternatePaymentTest::getObject());
}
}
@@ -0,0 +1,69 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\FundingOption;
/**
* Class FundingOption
*
* @package PayPal\Test\Api
*/
class FundingOptionTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object FundingOption
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","funding_sources":' . FundingSourceTest::getJson() . ',"backup_funding_instrument":' . FundingInstrumentTest::getJson() . ',"currency_conversion":' . CurrencyConversionTest::getJson() . ',"installment_info":' . InstallmentInfoTest::getJson() . ',"links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return FundingOption
*/
public static function getObject()
{
return new FundingOption(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return FundingOption
*/
public function testSerializationDeserialization()
{
$obj = new FundingOption(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getFundingSources());
$this->assertNotNull($obj->getBackupFundingInstrument());
$this->assertNotNull($obj->getCurrencyConversion());
$this->assertNotNull($obj->getInstallmentInfo());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param FundingOption $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getFundingSources(), FundingSourceTest::getObject());
$this->assertEquals($obj->getBackupFundingInstrument(), FundingInstrumentTest::getObject());
$this->assertEquals($obj->getCurrencyConversion(), CurrencyConversionTest::getObject());
$this->assertEquals($obj->getInstallmentInfo(), InstallmentInfoTest::getObject());
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
}
@@ -0,0 +1,75 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\FundingSource;
/**
* Class FundingSource
*
* @package PayPal\Test\Api
*/
class FundingSourceTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object FundingSource
*
* @return string
*/
public static function getJson()
{
return '{"funding_mode":"TestSample","funding_instrument_type":"TestSample","soft_descriptor":"TestSample","amount":' . CurrencyTest::getJson() . ',"legal_text":"TestSample","funding_detail":' . FundingDetailTest::getJson() . ',"additional_text":"TestSample","extends":' . FundingInstrumentTest::getJson() . ',"links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return FundingSource
*/
public static function getObject()
{
return new FundingSource(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return FundingSource
*/
public function testSerializationDeserialization()
{
$obj = new FundingSource(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getFundingMode());
$this->assertNotNull($obj->getFundingInstrumentType());
$this->assertNotNull($obj->getSoftDescriptor());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getLegalText());
$this->assertNotNull($obj->getFundingDetail());
$this->assertNotNull($obj->getAdditionalText());
$this->assertNotNull($obj->getExtends());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param FundingSource $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getFundingMode(), "TestSample");
$this->assertEquals($obj->getFundingInstrumentType(), "TestSample");
$this->assertEquals($obj->getSoftDescriptor(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getLegalText(), "TestSample");
$this->assertEquals($obj->getFundingDetail(), FundingDetailTest::getObject());
$this->assertEquals($obj->getAdditionalText(), "TestSample");
$this->assertEquals($obj->getExtends(), FundingInstrumentTest::getObject());
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\HyperSchema;
/**
* Class HyperSchema
*
* @package PayPal\Test\Api
*/
class HyperSchemaTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object HyperSchema
* @return string
*/
public static function getJson()
{
return '{"fragmentResolution":"TestSample","readonly":true,"contentEncoding":"TestSample","pathStart":"TestSample","mediaType":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return HyperSchema
*/
public static function getObject()
{
return new HyperSchema(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return HyperSchema
*/
public function testSerializationDeserialization()
{
$obj = new HyperSchema(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getLinks());
$this->assertNotNull($obj->getFragmentResolution());
$this->assertNotNull($obj->getReadonly());
$this->assertNotNull($obj->getContentEncoding());
$this->assertNotNull($obj->getPathStart());
$this->assertNotNull($obj->getMediaType());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param HyperSchema $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
$this->assertEquals($obj->getFragmentResolution(), "TestSample");
$this->assertEquals($obj->getReadonly(), true);
$this->assertEquals($obj->getContentEncoding(), "TestSample");
$this->assertEquals($obj->getPathStart(), "TestSample");
$this->assertEquals($obj->getMediaType(), "TestSample");
}
}
@@ -0,0 +1,55 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Image;
/**
* Class Image
*
* @package PayPal\Test\Api
*/
class ImageTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Patch
* @return string
*/
public static function getJson()
{
return '{"image":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Image
*/
public static function getObject()
{
return new Image(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Image
*/
public function testSerializationDeserialization()
{
$obj = new Image(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getImage());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Image $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getImage(), "TestSample");
}
}
@@ -0,0 +1,84 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Incentive;
/**
* Class Incentive
*
* @package PayPal\Test\Api
*/
class IncentiveTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Incentive
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","code":"TestSample","name":"TestSample","description":"TestSample","minimum_purchase_amount":' . CurrencyTest::getJson() . ',"logo_image_url":"http://www.google.com","expiry_date":"TestSample","type":"TestSample","terms":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Incentive
*/
public static function getObject()
{
return new Incentive(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Incentive
*/
public function testSerializationDeserialization()
{
$obj = new Incentive(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getCode());
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getDescription());
$this->assertNotNull($obj->getMinimumPurchaseAmount());
$this->assertNotNull($obj->getLogoImageUrl());
$this->assertNotNull($obj->getExpiryDate());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getTerms());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Incentive $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getCode(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getDescription(), "TestSample");
$this->assertEquals($obj->getMinimumPurchaseAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getLogoImageUrl(), "http://www.google.com");
$this->assertEquals($obj->getExpiryDate(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getTerms(), "TestSample");
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage LogoImageUrl is not a fully qualified URL
*/
public function testUrlValidationForLogoImageUrl()
{
$obj = new Incentive();
$obj->setLogoImageUrl(null);
}
}
@@ -0,0 +1,59 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\InputFields;
/**
* Class InputFields
*
* @package PayPal\Test\Api
*/
class InputFieldsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object InputFields
* @return string
*/
public static function getJson()
{
return json_encode(json_decode('{"allow_note":true,"no_shipping":123,"address_override":123}'));
}
/**
* Gets Object Instance with Json data filled in
* @return InputFields
*/
public static function getObject()
{
return new InputFields(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return InputFields
*/
public function testSerializationDeserialization()
{
$obj = new InputFields(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getAllowNote());
$this->assertNotNull($obj->getNoShipping());
$this->assertNotNull($obj->getAddressOverride());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param InputFields $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getAllowNote(), true);
$this->assertEquals($obj->getNoShipping(), 123);
$this->assertEquals($obj->getAddressOverride(), 123);
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\InstallmentInfo;
/**
* Class InstallmentInfo
*
* @package PayPal\Test\Api
*/
class InstallmentInfoTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object InstallmentInfo
*
* @return string
*/
public static function getJson()
{
return '{"installment_id":"TestSample","network":"TestSample","issuer":"TestSample","installment_options":' . InstallmentOptionTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return InstallmentInfo
*/
public static function getObject()
{
return new InstallmentInfo(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return InstallmentInfo
*/
public function testSerializationDeserialization()
{
$obj = new InstallmentInfo(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getInstallmentId());
$this->assertNotNull($obj->getNetwork());
$this->assertNotNull($obj->getIssuer());
$this->assertNotNull($obj->getInstallmentOptions());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param InstallmentInfo $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getInstallmentId(), "TestSample");
$this->assertEquals($obj->getNetwork(), "TestSample");
$this->assertEquals($obj->getIssuer(), "TestSample");
$this->assertEquals($obj->getInstallmentOptions(), InstallmentOptionTest::getObject());
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\InstallmentOption;
/**
* Class InstallmentOption
*
* @package PayPal\Test\Api
*/
class InstallmentOptionTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object InstallmentOption
*
* @return string
*/
public static function getJson()
{
return '{"term":123,"monthly_payment":' . CurrencyTest::getJson() . ',"discount_amount":' . CurrencyTest::getJson() . ',"discount_percentage":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return InstallmentOption
*/
public static function getObject()
{
return new InstallmentOption(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return InstallmentOption
*/
public function testSerializationDeserialization()
{
$obj = new InstallmentOption(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getTerm());
$this->assertNotNull($obj->getMonthlyPayment());
$this->assertNotNull($obj->getDiscountAmount());
$this->assertNotNull($obj->getDiscountPercentage());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param InstallmentOption $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getTerm(), 123);
$this->assertEquals($obj->getMonthlyPayment(), CurrencyTest::getObject());
$this->assertEquals($obj->getDiscountAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getDiscountPercentage(), "TestSample");
}
}
@@ -0,0 +1,67 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\InvoiceAddress;
/**
* Class InvoiceAddress
*
* @package PayPal\Test\Api
*/
class InvoiceAddressTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Address
* @return string
*/
public static function getJson()
{
return '{"line1":"TestSample","line2":"TestSample","city":"TestSample","country_code":"TestSample","postal_code":"TestSample","state":"TestSample","phone":'. PhoneTest::getJson() . "}";
}
/**
* Gets Object Instance with Json data filled in
* @return InvoiceAddress
*/
public static function getObject()
{
return new InvoiceAddress(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return InvoiceAddress
*/
public function testSerializationDeserialization()
{
$obj = new InvoiceAddress(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getLine1());
$this->assertNotNull($obj->getLine2());
$this->assertNotNull($obj->getCity());
$this->assertNotNull($obj->getCountryCode());
$this->assertNotNull($obj->getPostalCode());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getPhone());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param InvoiceAddress $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getLine1(), "TestSample");
$this->assertEquals($obj->getLine2(), "TestSample");
$this->assertEquals($obj->getCity(), "TestSample");
$this->assertEquals($obj->getCountryCode(), "TestSample");
$this->assertEquals($obj->getPostalCode(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getPhone(), PhoneTest::getObject());
}
}
@@ -0,0 +1,67 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\InvoiceItem;
/**
* Class InvoiceItem
*
* @package PayPal\Test\Api
*/
class InvoiceItemTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object InvoiceItem
* @return string
*/
public static function getJson()
{
return '{"name":"TestSample","description":"TestSample","quantity":"12.34","unit_price":' .CurrencyTest::getJson() . ',"tax":' .TaxTest::getJson() . ',"date":"TestSample","discount":' .CostTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return InvoiceItem
*/
public static function getObject()
{
return new InvoiceItem(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return InvoiceItem
*/
public function testSerializationDeserialization()
{
$obj = new InvoiceItem(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getDescription());
$this->assertNotNull($obj->getQuantity());
$this->assertNotNull($obj->getUnitPrice());
$this->assertNotNull($obj->getTax());
$this->assertNotNull($obj->getDate());
$this->assertNotNull($obj->getDiscount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param InvoiceItem $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getDescription(), "TestSample");
$this->assertEquals($obj->getQuantity(), "12.34");
$this->assertEquals($obj->getUnitPrice(), CurrencyTest::getObject());
$this->assertEquals($obj->getTax(), TaxTest::getObject());
$this->assertEquals($obj->getDate(), "TestSample");
$this->assertEquals($obj->getDiscount(), CostTest::getObject());
}
}
@@ -0,0 +1,57 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\InvoiceSearchResponse;
/**
* Class InvoiceSearchResponse
*
* @package PayPal\Test\Api
*/
class InvoiceSearchResponseTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object InvoiceSearchResponse
* @return string
*/
public static function getJson()
{
return '{"total_count":123,"invoices":' .InvoiceTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return InvoiceSearchResponse
*/
public static function getObject()
{
return new InvoiceSearchResponse(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return InvoiceSearchResponse
*/
public function testSerializationDeserialization()
{
$obj = new InvoiceSearchResponse(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getTotalCount());
$this->assertNotNull($obj->getInvoices());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param InvoiceSearchResponse $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getTotalCount(), 123);
$this->assertEquals($obj->getInvoices(), InvoiceTest::getObject());
}
}
@@ -0,0 +1,356 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Invoice;
/**
* Class Invoice
*
* @package PayPal\Test\Api
*/
class InvoiceTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Invoice
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","number":"TestSample","uri":"TestSample","status":"TestSample","merchant_info":' .MerchantInfoTest::getJson() . ',"billing_info":' .BillingInfoTest::getJson() . ',"shipping_info":' .ShippingInfoTest::getJson() . ',"items":' .InvoiceItemTest::getJson() . ',"invoice_date":"TestSample","payment_term":' .PaymentTermTest::getJson() . ',"discount":' .CostTest::getJson() . ',"shipping_cost":' .ShippingCostTest::getJson() . ',"custom":' .CustomAmountTest::getJson() . ',"tax_calculated_after_discount":true,"tax_inclusive":true,"terms":"TestSample","note":"TestSample","merchant_memo":"TestSample","logo_url":"http://www.google.com","total_amount":' .CurrencyTest::getJson() . ',"payments":' .PaymentDetailTest::getJson() . ',"refunds":' .RefundDetailTest::getJson() . ',"metadata":' .MetadataTest::getJson() . ',"additional_data":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Invoice
*/
public static function getObject()
{
return new Invoice(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Invoice
*/
public function testSerializationDeserialization()
{
$obj = new Invoice(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getNumber());
$this->assertNotNull($obj->getUri());
$this->assertNotNull($obj->getStatus());
$this->assertNotNull($obj->getMerchantInfo());
$this->assertNotNull($obj->getBillingInfo());
$this->assertNotNull($obj->getShippingInfo());
$this->assertNotNull($obj->getItems());
$this->assertNotNull($obj->getInvoiceDate());
$this->assertNotNull($obj->getPaymentTerm());
$this->assertNotNull($obj->getDiscount());
$this->assertNotNull($obj->getShippingCost());
$this->assertNotNull($obj->getCustom());
$this->assertNotNull($obj->getTaxCalculatedAfterDiscount());
$this->assertNotNull($obj->getTaxInclusive());
$this->assertNotNull($obj->getTerms());
$this->assertNotNull($obj->getNote());
$this->assertNotNull($obj->getMerchantMemo());
$this->assertNotNull($obj->getLogoUrl());
$this->assertNotNull($obj->getTotalAmount());
$this->assertNotNull($obj->getPayments());
$this->assertNotNull($obj->getRefunds());
$this->assertNotNull($obj->getMetadata());
$this->assertNotNull($obj->getAdditionalData());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Invoice $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getNumber(), "TestSample");
$this->assertEquals($obj->getUri(), "TestSample");
$this->assertEquals($obj->getStatus(), "TestSample");
$this->assertEquals($obj->getMerchantInfo(), MerchantInfoTest::getObject());
$this->assertEquals($obj->getBillingInfo(), BillingInfoTest::getObject());
$this->assertEquals($obj->getShippingInfo(), ShippingInfoTest::getObject());
$this->assertEquals($obj->getItems(), InvoiceItemTest::getObject());
$this->assertEquals($obj->getInvoiceDate(), "TestSample");
$this->assertEquals($obj->getPaymentTerm(), PaymentTermTest::getObject());
$this->assertEquals($obj->getDiscount(), CostTest::getObject());
$this->assertEquals($obj->getShippingCost(), ShippingCostTest::getObject());
$this->assertEquals($obj->getCustom(), CustomAmountTest::getObject());
$this->assertEquals($obj->getTaxCalculatedAfterDiscount(), true);
$this->assertEquals($obj->getTaxInclusive(), true);
$this->assertEquals($obj->getTerms(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
$this->assertEquals($obj->getMerchantMemo(), "TestSample");
$this->assertEquals($obj->getLogoUrl(), "http://www.google.com");
$this->assertEquals($obj->getTotalAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getPayments(), PaymentDetailTest::getObject());
$this->assertEquals($obj->getRefunds(), RefundDetailTest::getObject());
$this->assertEquals($obj->getMetadata(), MetadataTest::getObject());
$this->assertEquals($obj->getAdditionalData(), "TestSample");
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage LogoUrl is not a fully qualified URL
*/
public function testUrlValidationForLogoUrl()
{
$obj = new Invoice();
$obj->setLogoUrl(null);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testSearch($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
InvoiceSearchResponseTest::getJson()
));
$search = SearchTest::getObject();
$result = $obj->search($search, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testSend($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$result = $obj->send($mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testRemind($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$notification = NotificationTest::getObject();
$result = $obj->remind($notification, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testCancel($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$cancelNotification = CancelNotificationTest::getObject();
$result = $obj->cancel($cancelNotification, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testRecordPayment($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$paymentDetail = PaymentDetailTest::getObject();
$result = $obj->recordPayment($paymentDetail, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testRecordRefund($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$refundDetail = RefundDetailTest::getObject();
$result = $obj->recordRefund($refundDetail, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
InvoiceTest::getJson()
));
$result = $obj->get("invoiceId", $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testGetAll($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
InvoiceSearchResponseTest::getJson()
));
$result = $obj->getAll(array(), $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->update($mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testDelete($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$result = $obj->delete($mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testQrCode($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
ImageTest::getJson()
));
$result = $obj->qrCode("invoiceId", array(), $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\ItemList;
/**
* Class ItemList
*
* @package PayPal\Test\Api
*/
class ItemListTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object ItemList
*
* @return string
*/
public static function getJson()
{
return '{"items":' . ItemTest::getJson() . ',"shipping_address":' . ShippingAddressTest::getJson() . ',"shipping_method":"TestSample","shipping_phone_number":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return ItemList
*/
public static function getObject()
{
return new ItemList(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return ItemList
*/
public function testSerializationDeserialization()
{
$obj = new ItemList(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getItems());
$this->assertNotNull($obj->getShippingAddress());
$this->assertNotNull($obj->getShippingMethod());
$this->assertNotNull($obj->getShippingPhoneNumber());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param ItemList $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getItems(), ItemTest::getObject());
$this->assertEquals($obj->getShippingAddress(), ShippingAddressTest::getObject());
$this->assertEquals($obj->getShippingMethod(), "TestSample");
$this->assertEquals($obj->getShippingPhoneNumber(), "TestSample");
}
}
@@ -0,0 +1,96 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Item;
/**
* Class Item
*
* @package PayPal\Test\Api
*/
class ItemTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Item
*
* @return string
*/
public static function getJson()
{
return '{"sku":"TestSample","name":"TestSample","description":"TestSample","quantity":"12.34","price":"12.34","currency":"TestSample","tax":"12.34","url":"http://www.google.com","category":"TestSample","weight":' . MeasurementTest::getJson() . ',"length":' . MeasurementTest::getJson() . ',"height":' . MeasurementTest::getJson() . ',"width":' . MeasurementTest::getJson() . ',"supplementary_data":' . NameValuePairTest::getJson() . ',"postback_data":' . NameValuePairTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Item
*/
public static function getObject()
{
return new Item(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Item
*/
public function testSerializationDeserialization()
{
$obj = new Item(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getSku());
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getDescription());
$this->assertNotNull($obj->getQuantity());
$this->assertNotNull($obj->getPrice());
$this->assertNotNull($obj->getCurrency());
$this->assertNotNull($obj->getTax());
$this->assertNotNull($obj->getUrl());
$this->assertNotNull($obj->getCategory());
$this->assertNotNull($obj->getWeight());
$this->assertNotNull($obj->getLength());
$this->assertNotNull($obj->getHeight());
$this->assertNotNull($obj->getWidth());
$this->assertNotNull($obj->getSupplementaryData());
$this->assertNotNull($obj->getPostbackData());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Item $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getSku(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getDescription(), "TestSample");
$this->assertEquals($obj->getQuantity(), "12.34");
$this->assertEquals($obj->getPrice(), "12.34");
$this->assertEquals($obj->getCurrency(), "TestSample");
$this->assertEquals($obj->getTax(), "12.34");
$this->assertEquals($obj->getUrl(), "http://www.google.com");
$this->assertEquals($obj->getCategory(), "TestSample");
$this->assertEquals($obj->getWeight(), MeasurementTest::getObject());
$this->assertEquals($obj->getLength(), MeasurementTest::getObject());
$this->assertEquals($obj->getHeight(), MeasurementTest::getObject());
$this->assertEquals($obj->getWidth(), MeasurementTest::getObject());
$this->assertEquals($obj->getSupplementaryData(), NameValuePairTest::getObject());
$this->assertEquals($obj->getPostbackData(), NameValuePairTest::getObject());
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Url is not a fully qualified URL
*/
public function testUrlValidationForUrl()
{
$obj = new Item();
$obj->setUrl(null);
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Links;
/**
* Class Links
*
* @package PayPal\Test\Api
*/
class LinksTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Links
* @return string
*/
public static function getJson()
{
return '{"href":"TestSample","rel":"TestSample","targetSchema":' .HyperSchemaTest::getJson() . ',"method":"TestSample","enctype":"TestSample","schema":' .HyperSchemaTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return Links
*/
public static function getObject()
{
return new Links(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Links
*/
public function testSerializationDeserialization()
{
$obj = new Links(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getHref());
$this->assertNotNull($obj->getRel());
$this->assertNotNull($obj->getTargetSchema());
$this->assertNotNull($obj->getMethod());
$this->assertNotNull($obj->getEnctype());
$this->assertNotNull($obj->getSchema());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Links $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getHref(), "TestSample");
$this->assertEquals($obj->getRel(), "TestSample");
$this->assertEquals($obj->getTargetSchema(), HyperSchemaTest::getObject());
$this->assertEquals($obj->getMethod(), "TestSample");
$this->assertEquals($obj->getEnctype(), "TestSample");
$this->assertEquals($obj->getSchema(), HyperSchemaTest::getObject());
}
}
@@ -0,0 +1,61 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Measurement;
/**
* Class Measurement
*
* @package PayPal\Test\Api
*/
class MeasurementTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Measurement
*
* @return string
*/
public static function getJson()
{
return '{"value":"TestSample","unit":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Measurement
*/
public static function getObject()
{
return new Measurement(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Measurement
*/
public function testSerializationDeserialization()
{
$obj = new Measurement(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getValue());
$this->assertNotNull($obj->getUnit());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Measurement $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getValue(), "TestSample");
$this->assertEquals($obj->getUnit(), "TestSample");
}
}
@@ -0,0 +1,73 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\MerchantInfo;
/**
* Class MerchantInfo
*
* @package PayPal\Test\Api
*/
class MerchantInfoTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object MerchantInfo
* @return string
*/
public static function getJson()
{
return '{"email":"TestSample","first_name":"TestSample","last_name":"TestSample","address":' .AddressTest::getJson() . ',"business_name":"TestSample","phone":' .PhoneTest::getJson() . ',"fax":' .PhoneTest::getJson() . ',"website":"TestSample","tax_id":"TestSample","additional_info":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return MerchantInfo
*/
public static function getObject()
{
return new MerchantInfo(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return MerchantInfo
*/
public function testSerializationDeserialization()
{
$obj = new MerchantInfo(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getEmail());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getAddress());
$this->assertNotNull($obj->getBusinessName());
$this->assertNotNull($obj->getPhone());
$this->assertNotNull($obj->getFax());
$this->assertNotNull($obj->getWebsite());
$this->assertNotNull($obj->getTaxId());
$this->assertNotNull($obj->getAdditionalInfo());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param MerchantInfo $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getEmail(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getAddress(), AddressTest::getObject());
$this->assertEquals($obj->getBusinessName(), "TestSample");
$this->assertEquals($obj->getPhone(), PhoneTest::getObject());
$this->assertEquals($obj->getFax(), PhoneTest::getObject());
$this->assertEquals($obj->getWebsite(), "TestSample");
$this->assertEquals($obj->getTaxId(), "TestSample");
$this->assertEquals($obj->getAdditionalInfo(), "TestSample");
}
}
@@ -0,0 +1,120 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\MerchantPreferences;
/**
* Class MerchantPreferences
*
* @package PayPal\Test\Api
*/
class MerchantPreferencesTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object MerchantPreferences
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","setup_fee":' .CurrencyTest::getJson() . ',"cancel_url":"http://www.google.com","return_url":"http://www.google.com","notify_url":"http://www.google.com","max_fail_attempts":"TestSample","auto_bill_amount":"TestSample","initial_fail_amount_action":"TestSample","accepted_payment_type":"TestSample","char_set":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return MerchantPreferences
*/
public static function getObject()
{
return new MerchantPreferences(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return MerchantPreferences
*/
public function testSerializationDeserialization()
{
$obj = new MerchantPreferences(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getSetupFee());
$this->assertNotNull($obj->getCancelUrl());
$this->assertNotNull($obj->getReturnUrl());
$this->assertNotNull($obj->getNotifyUrl());
$this->assertNotNull($obj->getMaxFailAttempts());
$this->assertNotNull($obj->getAutoBillAmount());
$this->assertNotNull($obj->getInitialFailAmountAction());
$this->assertNotNull($obj->getAcceptedPaymentType());
$this->assertNotNull($obj->getCharSet());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param MerchantPreferences $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getSetupFee(), CurrencyTest::getObject());
$this->assertEquals($obj->getCancelUrl(), "http://www.google.com");
$this->assertEquals($obj->getReturnUrl(), "http://www.google.com");
$this->assertEquals($obj->getNotifyUrl(), "http://www.google.com");
$this->assertEquals($obj->getMaxFailAttempts(), "TestSample");
$this->assertEquals($obj->getAutoBillAmount(), "TestSample");
$this->assertEquals($obj->getInitialFailAmountAction(), "TestSample");
$this->assertEquals($obj->getAcceptedPaymentType(), "TestSample");
$this->assertEquals($obj->getCharSet(), "TestSample");
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage CancelUrl is not a fully qualified URL
*/
public function testUrlValidationForCancelUrl()
{
$obj = new MerchantPreferences();
$obj->setCancelUrl(null);
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage ReturnUrl is not a fully qualified URL
*/
public function testUrlValidationForReturnUrl()
{
$obj = new MerchantPreferences();
$obj->setReturnUrl(null);
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage NotifyUrl is not a fully qualified URL
*/
public function testUrlValidationForNotifyUrl()
{
$obj = new MerchantPreferences();
$obj->setNotifyUrl(null);
}
public function testUrlValidationForCancelUrlDeprecated()
{
$obj = new MerchantPreferences();
$obj->setCancelUrl(null);
$this->assertNull($obj->getCancelUrl());
}
public function testUrlValidationForReturnUrlDeprecated()
{
$obj = new MerchantPreferences();
$obj->setReturnUrl(null);
$this->assertNull($obj->getReturnUrl());
}
public function testUrlValidationForNotifyUrlDeprecated()
{
$obj = new MerchantPreferences();
$obj->setNotifyUrl(null);
$this->assertNull($obj->getNotifyUrl());
}
}
@@ -0,0 +1,90 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Metadata;
/**
* Class Metadata
*
* @package PayPal\Test\Api
*/
class MetadataTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Metadata
* @return string
*/
public static function getJson()
{
return '{"created_date":"TestSample","created_by":"TestSample","cancelled_date":"TestSample","cancelled_by":"TestSample","last_updated_date":"TestSample","last_updated_by":"TestSample","first_sent_date":"TestSample","last_sent_date":"TestSample","last_sent_by":"TestSample","payer_view_url":"http://www.google.com"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Metadata
*/
public static function getObject()
{
return new Metadata(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Metadata
*/
public function testSerializationDeserialization()
{
$obj = new Metadata(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCreatedDate());
$this->assertNotNull($obj->getCreatedBy());
$this->assertNotNull($obj->getCancelledDate());
$this->assertNotNull($obj->getCancelledBy());
$this->assertNotNull($obj->getLastUpdatedDate());
$this->assertNotNull($obj->getLastUpdatedBy());
$this->assertNotNull($obj->getFirstSentDate());
$this->assertNotNull($obj->getLastSentDate());
$this->assertNotNull($obj->getLastSentBy());
$this->assertNotNull($obj->getPayerViewUrl());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Metadata $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCreatedDate(), "TestSample");
$this->assertEquals($obj->getCreatedBy(), "TestSample");
$this->assertEquals($obj->getCancelledDate(), "TestSample");
$this->assertEquals($obj->getCancelledBy(), "TestSample");
$this->assertEquals($obj->getLastUpdatedDate(), "TestSample");
$this->assertEquals($obj->getLastUpdatedBy(), "TestSample");
$this->assertEquals($obj->getFirstSentDate(), "TestSample");
$this->assertEquals($obj->getLastSentDate(), "TestSample");
$this->assertEquals($obj->getLastSentBy(), "TestSample");
$this->assertEquals($obj->getPayerViewUrl(), "http://www.google.com");
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage PayerViewUrl is not a fully qualified URL
*/
public function testUrlValidationForPayerViewUrl()
{
$obj = new Metadata();
$obj->setPayerViewUrl(null);
}
public function testUrlValidationForPayerViewUrlDeprecated()
{
$obj = new Metadata();
$obj->setPayer_view_url(null);
$this->assertNull($obj->getPayer_view_url());
}
}
@@ -0,0 +1,61 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\NameValuePair;
/**
* Class NameValuePair
*
* @package PayPal\Test\Api
*/
class NameValuePairTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object NameValuePair
*
* @return string
*/
public static function getJson()
{
return '{"name":"TestSample","value":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return NameValuePair
*/
public static function getObject()
{
return new NameValuePair(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return NameValuePair
*/
public function testSerializationDeserialization()
{
$obj = new NameValuePair(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getValue());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param NameValuePair $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getValue(), "TestSample");
}
}
@@ -0,0 +1,60 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Notification;
/**
* Class Notification
*
* @package PayPal\Test\Api
*/
class NotificationTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Notification
* @return string
*/
public static function getJson()
{
return '{"subject":"TestSample","note":"TestSample","send_to_merchant":true}';
}
/**
* Gets Object Instance with Json data filled in
* @return Notification
*/
public static function getObject()
{
return new Notification(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Notification
*/
public function testSerializationDeserialization()
{
$obj = new Notification(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getSubject());
$this->assertNotNull($obj->getNote());
$this->assertNotNull($obj->getSendToMerchant());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Notification $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getSubject(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
$this->assertEquals($obj->getSendToMerchant(), true);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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");
}
}
@@ -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);
}
}
@@ -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'));
}
}
@@ -0,0 +1,178 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Authorization;
use PayPal\Api\Order;
/**
* Class Order
*
* @package PayPal\Test\Api
*/
class OrderTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Order
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","purchase_unit_reference_id":"TestSample","amount":' . AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","parent_payment":"TestSample","fmf_details":' . FmfDetailsTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Order
*/
public static function getObject()
{
return new Order(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Order
*/
public function testSerializationDeserialization()
{
$obj = new Order(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getPurchaseUnitReferenceId());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getPaymentMode());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getReasonCode());
$this->assertNotNull($obj->getPendingReason());
$this->assertNotNull($obj->getProtectionEligibility());
$this->assertNotNull($obj->getProtectionEligibilityType());
$this->assertNotNull($obj->getParentPayment());
$this->assertNotNull($obj->getFmfDetails());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Order $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getPurchaseUnitReferenceId(), "TestSample");
$this->assertEquals($obj->getAmount(), AmountTest::getObject());
$this->assertEquals($obj->getPaymentMode(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getReasonCode(), "TestSample");
$this->assertEquals($obj->getPendingReason(), "TestSample");
$this->assertEquals($obj->getProtectionEligibility(), "TestSample");
$this->assertEquals($obj->getProtectionEligibilityType(), "TestSample");
$this->assertEquals($obj->getParentPayment(), "TestSample");
$this->assertEquals($obj->getFmfDetails(), FmfDetailsTest::getObject());
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @dataProvider mockProvider
* @param Order $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
OrderTest::getJson()
));
$result = $obj->get("orderId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Order $obj
*/
public function testCapture($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
CaptureTest::getJson()
));
$capture = CaptureTest::getObject();
$result = $obj->capture($capture, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Order $obj
*/
public function testVoid($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->void($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Order $obj
*/
public function testAuthorize($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
AuthorizationTest::getJson()
));
$authorization = new Authorization();
$result = $obj->authorize($authorization, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}
@@ -0,0 +1,57 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\OverrideChargeModel;
/**
* Class OverrideChargeModel
*
* @package PayPal\Test\Api
*/
class OverrideChargeModelTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object OverrideChargeModel
* @return string
*/
public static function getJson()
{
return '{"charge_id":"TestSample","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return OverrideChargeModel
*/
public static function getObject()
{
return new OverrideChargeModel(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return OverrideChargeModel
*/
public function testSerializationDeserialization()
{
$obj = new OverrideChargeModel(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getChargeId());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param OverrideChargeModel $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getChargeId(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
}
@@ -0,0 +1,54 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PatchRequest;
/**
* Class PatchRequest
*
* @package PayPal\Test\Api
*/
class PatchRequestTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PatchRequest
* @return string
*/
public static function getJson()
{
return '{"patches":' .PatchTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PatchRequest
*/
public static function getObject()
{
return new PatchRequest(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PatchRequest
*/
public function testSerializationDeserialization()
{
$obj = new PatchRequest(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPatches());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PatchRequest $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPatches(), PatchTest::getObject());
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Patch;
/**
* Class Patch
*
* @package PayPal\Test\Api
*/
class PatchTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Patch
*
* @return string
*/
public static function getJson()
{
return '{"op":"TestSample","path":"TestSample","value":"TestSampleObject","from":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Patch
*/
public static function getObject()
{
return new Patch(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Patch
*/
public function testSerializationDeserialization()
{
$obj = new Patch(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getOp());
$this->assertNotNull($obj->getPath());
$this->assertNotNull($obj->getValue());
$this->assertNotNull($obj->getFrom());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Patch $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getOp(), "TestSample");
$this->assertEquals($obj->getPath(), "TestSample");
$this->assertEquals($obj->getValue(), "TestSampleObject");
$this->assertEquals($obj->getFrom(), "TestSample");
}
}
@@ -0,0 +1,69 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Payee;
/**
* Class Payee
*
* @package PayPal\Test\Api
*/
class PayeeTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Payee
*
* @return string
*/
public static function getJson()
{
return '{"email":"TestSample","merchant_id":"TestSample","first_name":"TestSample","last_name":"TestSample","account_number":"TestSample","phone":' . PhoneTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Payee
*/
public static function getObject()
{
return new Payee(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Payee
*/
public function testSerializationDeserialization()
{
$obj = new Payee(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getEmail());
$this->assertNotNull($obj->getMerchantId());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getAccountNumber());
$this->assertNotNull($obj->getPhone());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Payee $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getEmail(), "TestSample");
$this->assertEquals($obj->getMerchantId(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getAccountNumber(), "TestSample");
$this->assertEquals($obj->getPhone(), PhoneTest::getObject());
}
}
@@ -0,0 +1,91 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PayerInfo;
/**
* Class PayerInfo
*
* @package PayPal\Test\Api
*/
class PayerInfoTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PayerInfo
*
* @return string
*/
public static function getJson()
{
return '{"email":"TestSample","external_remember_me_id":"TestSample","account_number":"TestSample","salutation":"TestSample","first_name":"TestSample","middle_name":"TestSample","last_name":"TestSample","suffix":"TestSample","payer_id":"TestSample","phone":"TestSample","phone_type":"TestSample","birth_date":"TestSample","tax_id":"TestSample","tax_id_type":"TestSample","country_code":"TestSample","billing_address":' . AddressTest::getJson() . ',"shipping_address":' . ShippingAddressTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return PayerInfo
*/
public static function getObject()
{
return new PayerInfo(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return PayerInfo
*/
public function testSerializationDeserialization()
{
$obj = new PayerInfo(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getEmail());
$this->assertNotNull($obj->getExternalRememberMeId());
$this->assertNotNull($obj->getAccountNumber());
$this->assertNotNull($obj->getSalutation());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getMiddleName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getSuffix());
$this->assertNotNull($obj->getPayerId());
$this->assertNotNull($obj->getPhone());
$this->assertNotNull($obj->getPhoneType());
$this->assertNotNull($obj->getBirthDate());
$this->assertNotNull($obj->getTaxId());
$this->assertNotNull($obj->getTaxIdType());
$this->assertNotNull($obj->getCountryCode());
$this->assertNotNull($obj->getBillingAddress());
$this->assertNotNull($obj->getShippingAddress());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PayerInfo $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getEmail(), "TestSample");
$this->assertEquals($obj->getExternalRememberMeId(), "TestSample");
$this->assertEquals($obj->getAccountNumber(), "TestSample");
$this->assertEquals($obj->getSalutation(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getMiddleName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getSuffix(), "TestSample");
$this->assertEquals($obj->getPayerId(), "TestSample");
$this->assertEquals($obj->getPhone(), "TestSample");
$this->assertEquals($obj->getPhoneType(), "TestSample");
$this->assertEquals($obj->getBirthDate(), "TestSample");
$this->assertEquals($obj->getTaxId(), "TestSample");
$this->assertEquals($obj->getTaxIdType(), "TestSample");
$this->assertEquals($obj->getCountryCode(), "TestSample");
$this->assertEquals($obj->getBillingAddress(), AddressTest::getObject());
$this->assertEquals($obj->getShippingAddress(), ShippingAddressTest::getObject());
}
}
@@ -0,0 +1,75 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Payer;
/**
* Class Payer
*
* @package PayPal\Test\Api
*/
class PayerTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Payer
*
* @return string
*/
public static function getJson()
{
return '{"payment_method":"TestSample","status":"TestSample","account_type":"TestSample","account_age":"TestSample","funding_instruments":' . FundingInstrumentTest::getJson() . ',"funding_option_id":"TestSample","funding_option":' . FundingOptionTest::getJson() . ',"related_funding_option":' . FundingOptionTest::getJson() . ',"payer_info":' . PayerInfoTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Payer
*/
public static function getObject()
{
return new Payer(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Payer
*/
public function testSerializationDeserialization()
{
$obj = new Payer(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPaymentMethod());
$this->assertNotNull($obj->getStatus());
$this->assertNotNull($obj->getAccountType());
$this->assertNotNull($obj->getAccountAge());
$this->assertNotNull($obj->getFundingInstruments());
$this->assertNotNull($obj->getFundingOptionId());
$this->assertNotNull($obj->getFundingOption());
$this->assertNotNull($obj->getRelatedFundingOption());
$this->assertNotNull($obj->getPayerInfo());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Payer $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPaymentMethod(), "TestSample");
$this->assertEquals($obj->getStatus(), "TestSample");
$this->assertEquals($obj->getAccountType(), "TestSample");
$this->assertEquals($obj->getAccountAge(), "TestSample");
$this->assertEquals($obj->getFundingInstruments(), FundingInstrumentTest::getObject());
$this->assertEquals($obj->getFundingOptionId(), "TestSample");
$this->assertEquals($obj->getFundingOption(), FundingOptionTest::getObject());
$this->assertEquals($obj->getRelatedFundingOption(), FundingOptionTest::getObject());
$this->assertEquals($obj->getPayerInfo(), PayerInfoTest::getObject());
}
}
@@ -0,0 +1,91 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PaymentCard;
/**
* Class PaymentCard
*
* @package PayPal\Test\Api
*/
class PaymentCardTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentCard
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"start_month":"TestSample","start_year":"TestSample","cvv2":"TestSample","first_name":"TestSample","last_name":"TestSample","billing_country":"TestSample","billing_address":' . AddressTest::getJson() . ',"external_customer_id":"TestSample","status":"TestSample","valid_until":"TestSample","issue_number":"TestSample","links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return PaymentCard
*/
public static function getObject()
{
return new PaymentCard(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return PaymentCard
*/
public function testSerializationDeserialization()
{
$obj = new PaymentCard(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getNumber());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getExpireMonth());
$this->assertNotNull($obj->getExpireYear());
$this->assertNotNull($obj->getStartMonth());
$this->assertNotNull($obj->getStartYear());
$this->assertNotNull($obj->getCvv2());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getBillingCountry());
$this->assertNotNull($obj->getBillingAddress());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getStatus());
$this->assertNotNull($obj->getValidUntil());
$this->assertNotNull($obj->getIssueNumber());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentCard $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getNumber(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getExpireMonth(), 123);
$this->assertEquals($obj->getExpireYear(), 123);
$this->assertEquals($obj->getStartMonth(), "TestSample");
$this->assertEquals($obj->getStartYear(), "TestSample");
$this->assertEquals($obj->getCvv2(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getBillingCountry(), "TestSample");
$this->assertEquals($obj->getBillingAddress(), AddressTest::getObject());
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getStatus(), "TestSample");
$this->assertEquals($obj->getValidUntil(), "TestSample");
$this->assertEquals($obj->getIssueNumber(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PaymentCardToken;
/**
* Class PaymentCardToken
*
* @package PayPal\Test\Api
*/
class PaymentCardTokenTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentCardToken
* @return string
*/
public static function getJson()
{
return '{"payment_card_id":"TestSample","external_customer_id":"TestSample","last4":"TestSample","type":"TestSample","expire_month":123,"expire_year":123}';
}
/**
* Gets Object Instance with Json data filled in
* @return PaymentCardToken
*/
public static function getObject()
{
return new PaymentCardToken(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PaymentCardToken
*/
public function testSerializationDeserialization()
{
$obj = new PaymentCardToken(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPaymentCardId());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getLast4());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getExpireMonth());
$this->assertNotNull($obj->getExpireYear());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentCardToken $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPaymentCardId(), "TestSample");
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getLast4(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getExpireMonth(), 123);
$this->assertEquals($obj->getExpireYear(), 123);
}
}
@@ -0,0 +1,69 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PaymentDefinition;
/**
* Class PaymentDefinition
*
* @package PayPal\Test\Api
*/
class PaymentDefinitionTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentDefinition
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","name":"TestSample","type":"TestSample","frequency_interval":"TestSample","frequency":"TestSample","cycles":"TestSample","amount":' .CurrencyTest::getJson() . ',"charge_models":' .ChargeModelTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PaymentDefinition
*/
public static function getObject()
{
return new PaymentDefinition(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PaymentDefinition
*/
public function testSerializationDeserialization()
{
$obj = new PaymentDefinition(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getFrequencyInterval());
$this->assertNotNull($obj->getFrequency());
$this->assertNotNull($obj->getCycles());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getChargeModels());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentDefinition $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getFrequencyInterval(), "TestSample");
$this->assertEquals($obj->getFrequency(), "TestSample");
$this->assertEquals($obj->getCycles(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getChargeModels(), ChargeModelTest::getObject());
}
}
@@ -0,0 +1,65 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PaymentDetail;
/**
* Class PaymentDetail
*
* @package PayPal\Test\Api
*/
class PaymentDetailTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentDetail
* @return string
*/
public static function getJson()
{
return '{"type":"TestSample","transaction_id":"TestSample","transaction_type":"TestSample","date":"TestSample","method":"TestSample","note":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return PaymentDetail
*/
public static function getObject()
{
return new PaymentDetail(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PaymentDetail
*/
public function testSerializationDeserialization()
{
$obj = new PaymentDetail(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getTransactionId());
$this->assertNotNull($obj->getTransactionType());
$this->assertNotNull($obj->getDate());
$this->assertNotNull($obj->getMethod());
$this->assertNotNull($obj->getNote());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentDetail $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getTransactionId(), "TestSample");
$this->assertEquals($obj->getTransactionType(), "TestSample");
$this->assertEquals($obj->getDate(), "TestSample");
$this->assertEquals($obj->getMethod(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
}
}
@@ -0,0 +1,63 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PaymentExecution;
/**
* Class PaymentExecution
*
* @package PayPal\Test\Api
*/
class PaymentExecutionTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentExecution
*
* @return string
*/
public static function getJson()
{
return '{"payer_id":"TestSample","carrier_account_id":"TestSample","transactions":[' . TransactionTest::getJson() . ']}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return PaymentExecution
*/
public static function getObject()
{
return new PaymentExecution(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return PaymentExecution
*/
public function testSerializationDeserialization()
{
$obj = new PaymentExecution(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPayerId());
$this->assertNotNull($obj->getCarrierAccountId());
$this->assertNotNull($obj->getTransactions());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentExecution $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPayerId(), "TestSample");
$this->assertEquals($obj->getCarrierAccountId(), "TestSample");
$this->assertEquals($obj->getTransactions(), array(TransactionTest::getObject()));
}
}
@@ -0,0 +1,63 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PaymentHistory;
/**
* Class PaymentHistory
*
* @package PayPal\Test\Api
*/
class PaymentHistoryTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentHistory
*
* @return string
*/
public static function getJson()
{
return '{"payments":' . PaymentTest::getJson() . ',"count":123,"next_id":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return PaymentHistory
*/
public static function getObject()
{
return new PaymentHistory(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return PaymentHistory
*/
public function testSerializationDeserialization()
{
$obj = new PaymentHistory(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPayments());
$this->assertNotNull($obj->getCount());
$this->assertNotNull($obj->getNextId());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentHistory $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPayments(), PaymentTest::getObject());
$this->assertEquals($obj->getCount(), 123);
$this->assertEquals($obj->getNextId(), "TestSample");
}
}
@@ -0,0 +1,99 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PaymentInstruction;
use PayPal\Transport\PPRestCall;
/**
* Class PaymentInstruction
*
* @package PayPal\Test\Api
*/
class PaymentInstructionTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentInstruction
* @return string
*/
public static function getJson()
{
return '{"reference_number":"TestSample","instruction_type":"TestSample","recipient_banking_instruction":' .RecipientBankingInstructionTest::getJson() . ',"amount":' .CurrencyTest::getJson() . ',"payment_due_date":"TestSample","note":"TestSample","links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PaymentInstruction
*/
public static function getObject()
{
return new PaymentInstruction(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PaymentInstruction
*/
public function testSerializationDeserialization()
{
$obj = new PaymentInstruction(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getReferenceNumber());
$this->assertNotNull($obj->getInstructionType());
$this->assertNotNull($obj->getRecipientBankingInstruction());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getPaymentDueDate());
$this->assertNotNull($obj->getNote());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentInstruction $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getReferenceNumber(), "TestSample");
$this->assertEquals($obj->getInstructionType(), "TestSample");
$this->assertEquals($obj->getRecipientBankingInstruction(), RecipientBankingInstructionTest::getObject());
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getPaymentDueDate(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @dataProvider mockProvider
* @param PaymentInstruction $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PaymentInstructionTest::getJson()
));
$result = $obj->get("paymentId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}
@@ -0,0 +1,63 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PaymentOptions;
/**
* Class PaymentOptions
*
* @package PayPal\Test\Api
*/
class PaymentOptionsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentOptions
*
* @return string
*/
public static function getJson()
{
return '{"allowed_payment_method":"TestSample","recurring_flag":true,"skip_fmf":true}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return PaymentOptions
*/
public static function getObject()
{
return new PaymentOptions(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return PaymentOptions
*/
public function testSerializationDeserialization()
{
$obj = new PaymentOptions(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getAllowedPaymentMethod());
$this->assertNotNull($obj->getRecurringFlag());
$this->assertNotNull($obj->getSkipFmf());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentOptions $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getAllowedPaymentMethod(), "TestSample");
$this->assertEquals($obj->getRecurringFlag(), true);
$this->assertEquals($obj->getSkipFmf(), true);
}
}
@@ -0,0 +1,57 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PaymentTerm;
/**
* Class PaymentTerm
*
* @package PayPal\Test\Api
*/
class PaymentTermTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentTerm
* @return string
*/
public static function getJson()
{
return '{"term_type":"TestSample","due_date":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return PaymentTerm
*/
public static function getObject()
{
return new PaymentTerm(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PaymentTerm
*/
public function testSerializationDeserialization()
{
$obj = new PaymentTerm(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getTermType());
$this->assertNotNull($obj->getDueDate());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentTerm $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getTermType(), "TestSample");
$this->assertEquals($obj->getDueDate(), "TestSample");
}
}
@@ -0,0 +1,209 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\object;
use PayPal\Api\Payment;
/**
* Class Payment
*
* @package PayPal\Test\Api
*/
class PaymentTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Payment
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","intent":"TestSample","payer":' . PayerTest::getJson() . ',"potential_payer_info":' . PotentialPayerInfoTest::getJson() . ',"payee":' . PayeeTest::getJson() . ',"cart":"TestSample","transactions":[' . TransactionTest::getJson() . '],"failed_transactions":' . ErrorTest::getJson() . ',"billing_agreement_tokens":["TestSample"],"credit_financing_offered":' . CreditFinancingOfferedTest::getJson() . ',"payment_instruction":' . PaymentInstructionTest::getJson() . ',"state":"TestSample","experience_profile_id":"TestSample","note_to_payer":"TestSample","redirect_urls":' . RedirectUrlsTest::getJson() . ',"failure_reason":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Payment
*/
public static function getObject()
{
return new Payment(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Payment
*/
public function testSerializationDeserialization()
{
$obj = new Payment(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getIntent());
$this->assertNotNull($obj->getPayer());
$this->assertNotNull($obj->getPotentialPayerInfo());
$this->assertNotNull($obj->getPayee());
$this->assertNotNull($obj->getCart());
$this->assertNotNull($obj->getTransactions());
$this->assertNotNull($obj->getFailedTransactions());
$this->assertNotNull($obj->getBillingAgreementTokens());
$this->assertNotNull($obj->getCreditFinancingOffered());
$this->assertNotNull($obj->getPaymentInstruction());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getExperienceProfileId());
$this->assertNotNull($obj->getNoteToPayer());
$this->assertNotNull($obj->getRedirectUrls());
$this->assertNotNull($obj->getFailureReason());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Payment $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getIntent(), "TestSample");
$this->assertEquals($obj->getPayer(), PayerTest::getObject());
$this->assertEquals($obj->getPotentialPayerInfo(), PotentialPayerInfoTest::getObject());
$this->assertEquals($obj->getPayee(), PayeeTest::getObject());
$this->assertEquals($obj->getCart(), "TestSample");
$this->assertEquals($obj->getTransactions(), array(TransactionTest::getObject()));
$this->assertEquals($obj->getFailedTransactions(), ErrorTest::getObject());
$this->assertEquals($obj->getBillingAgreementTokens(), array("TestSample"));
$this->assertEquals($obj->getCreditFinancingOffered(), CreditFinancingOfferedTest::getObject());
$this->assertEquals($obj->getPaymentInstruction(), PaymentInstructionTest::getObject());
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getExperienceProfileId(), "TestSample");
$this->assertEquals($obj->getNoteToPayer(), "TestSample");
$this->assertEquals($obj->getRedirectUrls(), RedirectUrlsTest::getObject());
$this->assertEquals($obj->getFailureReason(), "TestSample");
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @dataProvider mockProvider
* @param Payment $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Payment $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PaymentTest::getJson()
));
$result = $obj->get("paymentId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Payment $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$patchRequest = PatchRequestTest::getObject();
$result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Payment $obj
*/
public function testExecute($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$paymentExecution = PaymentExecutionTest::getObject();
$result = $obj->execute($paymentExecution, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Payment $obj
*/
public function testList($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PaymentHistoryTest::getJson()
));
$params = array();
$result = $obj->all($params, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}
@@ -0,0 +1,71 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PayoutBatchHeader;
/**
* Class PayoutBatchHeader
*
* @package PayPal\Test\Api
*/
class PayoutBatchHeaderTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PayoutBatchHeader
* @return string
*/
public static function getJson()
{
return '{"payout_batch_id":"TestSample","batch_status":"TestSample","time_created":"TestSample","time_completed":"TestSample","sender_batch_header":' .PayoutSenderBatchHeaderTest::getJson() . ',"amount":' .CurrencyTest::getJson() . ',"fees":' .CurrencyTest::getJson() . ',"errors":' .ErrorTest::getJson() . ',"links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PayoutBatchHeader
*/
public static function getObject()
{
return new PayoutBatchHeader(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PayoutBatchHeader
*/
public function testSerializationDeserialization()
{
$obj = new PayoutBatchHeader(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPayoutBatchId());
$this->assertNotNull($obj->getBatchStatus());
$this->assertNotNull($obj->getTimeCreated());
$this->assertNotNull($obj->getTimeCompleted());
$this->assertNotNull($obj->getSenderBatchHeader());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getFees());
$this->assertNotNull($obj->getErrors());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PayoutBatchHeader $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPayoutBatchId(), "TestSample");
$this->assertEquals($obj->getBatchStatus(), "TestSample");
$this->assertEquals($obj->getTimeCreated(), "TestSample");
$this->assertEquals($obj->getTimeCompleted(), "TestSample");
$this->assertEquals($obj->getSenderBatchHeader(), PayoutSenderBatchHeaderTest::getObject());
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getFees(), CurrencyTest::getObject());
$this->assertEquals($obj->getErrors(), ErrorTest::getObject());
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
}
@@ -0,0 +1,57 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PayoutBatch;
/**
* Class PayoutBatch
*
* @package PayPal\Test\Api
*/
class PayoutBatchTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PayoutBatch
* @return string
*/
public static function getJson()
{
return '{"batch_header":' .PayoutBatchHeaderTest::getJson() . ',"items":' .PayoutItemDetailsTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PayoutBatch
*/
public static function getObject()
{
return new PayoutBatch(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PayoutBatch
*/
public function testSerializationDeserialization()
{
$obj = new PayoutBatch(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getBatchHeader());
$this->assertNotNull($obj->getItems());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PayoutBatch $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getBatchHeader(), PayoutBatchHeaderTest::getObject());
$this->assertEquals($obj->getItems(), PayoutItemDetailsTest::getObject());
}
}
@@ -0,0 +1,73 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PayoutItemDetails;
/**
* Class PayoutItemDetails
*
* @package PayPal\Test\Api
*/
class PayoutItemDetailsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PayoutItemDetails
* @return string
*/
public static function getJson()
{
return '{"payout_item_id":"TestSample","transaction_id":"TestSample","transaction_status":"TestSample","payout_item_fee":' .CurrencyTest::getJson() . ',"payout_batch_id":"TestSample","sender_batch_id":"TestSample","payout_item":' .PayoutItemTest::getJson() . ',"time_processed":"TestSample","errors":' .ErrorTest::getJson() . ',"links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PayoutItemDetails
*/
public static function getObject()
{
return new PayoutItemDetails(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PayoutItemDetails
*/
public function testSerializationDeserialization()
{
$obj = new PayoutItemDetails(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPayoutItemId());
$this->assertNotNull($obj->getTransactionId());
$this->assertNotNull($obj->getTransactionStatus());
$this->assertNotNull($obj->getPayoutItemFee());
$this->assertNotNull($obj->getPayoutBatchId());
$this->assertNotNull($obj->getSenderBatchId());
$this->assertNotNull($obj->getPayoutItem());
$this->assertNotNull($obj->getTimeProcessed());
$this->assertNotNull($obj->getErrors());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PayoutItemDetails $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPayoutItemId(), "TestSample");
$this->assertEquals($obj->getTransactionId(), "TestSample");
$this->assertEquals($obj->getTransactionStatus(), "TestSample");
$this->assertEquals($obj->getPayoutItemFee(), CurrencyTest::getObject());
$this->assertEquals($obj->getPayoutBatchId(), "TestSample");
$this->assertEquals($obj->getSenderBatchId(), "TestSample");
$this->assertEquals($obj->getPayoutItem(), PayoutItemTest::getObject());
$this->assertEquals($obj->getTimeProcessed(), "TestSample");
$this->assertEquals($obj->getErrors(), ErrorTest::getObject());
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
}
@@ -0,0 +1,116 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\ItemsArray;
use PayPal\Api\PayoutItem;
use PayPal\Transport\PPRestCall;
/**
* Class PayoutItem
*
* @package PayPal\Test\Api
*/
class PayoutItemTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PayoutItem
* @return string
*/
public static function getJson()
{
return '{"recipient_type":"TestSample","amount":' .CurrencyTest::getJson() . ',"note":"TestSample","receiver":"TestSample","sender_item_id":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return PayoutItem
*/
public static function getObject()
{
return new PayoutItem(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PayoutItem
*/
public function testSerializationDeserialization()
{
$obj = new PayoutItem(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getRecipientType());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getNote());
$this->assertNotNull($obj->getReceiver());
$this->assertNotNull($obj->getSenderItemId());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PayoutItem $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getRecipientType(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getNote(), "TestSample");
$this->assertEquals($obj->getReceiver(), "TestSample");
$this->assertEquals($obj->getSenderItemId(), "TestSample");
}
/**
* @dataProvider mockProvider
* @param PayoutItem $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PayoutItemDetailsTest::getJson()
));
$result = $obj->get("payoutItemId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param PayoutItem $obj
*/
public function testCancel($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PayoutItemDetailsTest::getJson()
));
$result = $obj->cancel("payoutItemId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}
@@ -0,0 +1,59 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PayoutSenderBatchHeader;
/**
* Class PayoutSenderBatchHeader
*
* @package PayPal\Test\Api
*/
class PayoutSenderBatchHeaderTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PayoutSenderBatchHeader
* @return string
*/
public static function getJson()
{
return '{"sender_batch_id":"TestSample","email_subject":"TestSample","recipient_type":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return PayoutSenderBatchHeader
*/
public static function getObject()
{
return new PayoutSenderBatchHeader(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PayoutSenderBatchHeader
*/
public function testSerializationDeserialization()
{
$obj = new PayoutSenderBatchHeader(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getSenderBatchId());
$this->assertNotNull($obj->getEmailSubject());
$this->assertNotNull($obj->getRecipientType());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PayoutSenderBatchHeader $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getSenderBatchId(), "TestSample");
$this->assertEquals($obj->getEmailSubject(), "TestSample");
$this->assertEquals($obj->getRecipientType(), "TestSample");
}
}
@@ -0,0 +1,110 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Payout;
/**
* Class Payout
*
* @package PayPal\Test\Api
*/
class PayoutTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Payout
* @return string
*/
public static function getJson()
{
return '{"sender_batch_header":' .PayoutSenderBatchHeaderTest::getJson() . ',"items":' .PayoutItemTest::getJson() . ',"links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return Payout
*/
public static function getObject()
{
return new Payout(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Payout
*/
public function testSerializationDeserialization()
{
$obj = new Payout(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getSenderBatchHeader());
$this->assertNotNull($obj->getItems());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Payout $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getSenderBatchHeader(), PayoutSenderBatchHeaderTest::getObject());
$this->assertEquals($obj->getItems(), PayoutItemTest::getObject());
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @dataProvider mockProvider
* @param Payout $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PayoutBatchTest::getJson()
));
$params = array();
$result = $obj->create($params, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Payout $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PayoutBatchTest::getJson()
));
$result = $obj->get("payoutBatchId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}
@@ -0,0 +1,63 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Phone;
/**
* Class Phone
*
* @package PayPal\Test\Api
*/
class PhoneTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Phone
*
* @return string
*/
public static function getJson()
{
return '{"country_code":"TestSample","national_number":"TestSample","extension":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Phone
*/
public static function getObject()
{
return new Phone(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Phone
*/
public function testSerializationDeserialization()
{
$obj = new Phone(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCountryCode());
$this->assertNotNull($obj->getNationalNumber());
$this->assertNotNull($obj->getExtension());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Phone $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCountryCode(), "TestSample");
$this->assertEquals($obj->getNationalNumber(), "TestSample");
$this->assertEquals($obj->getExtension(), "TestSample");
}
}
@@ -0,0 +1,61 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PlanList;
/**
* Class PlanList
*
* @package PayPal\Test\Api
*/
class PlanListTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PlanList
* @return string
*/
public static function getJson()
{
return '{"plans":' .PlanTest::getJson() . ',"total_items":"TestSample","total_pages":"TestSample","links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PlanList
*/
public static function getObject()
{
return new PlanList(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PlanList
*/
public function testSerializationDeserialization()
{
$obj = new PlanList(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPlans());
$this->assertNotNull($obj->getTotalItems());
$this->assertNotNull($obj->getTotalPages());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PlanList $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPlans(), PlanTest::getObject());
$this->assertEquals($obj->getTotalItems(), "TestSample");
$this->assertEquals($obj->getTotalPages(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
}
@@ -0,0 +1,165 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Plan;
/**
* Class Plan
*
* @package PayPal\Test\Api
*/
class PlanTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Plan
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","name":"TestSample","description":"TestSample","type":"TestSample","state":"TestSample","create_time":"TestSample","update_time":"TestSample","payment_definitions":' .PaymentDefinitionTest::getJson() . ',"terms":' .TermsTest::getJson() . ',"merchant_preferences":' .MerchantPreferencesTest::getJson() . ',"links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return Plan
*/
public static function getObject()
{
return new Plan(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Plan
*/
public function testSerializationDeserialization()
{
$obj = new Plan(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getDescription());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getPaymentDefinitions());
$this->assertNotNull($obj->getTerms());
$this->assertNotNull($obj->getMerchantPreferences());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Plan $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getDescription(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getPaymentDefinitions(), PaymentDefinitionTest::getObject());
$this->assertEquals($obj->getTerms(), TermsTest::getObject());
$this->assertEquals($obj->getMerchantPreferences(), MerchantPreferencesTest::getObject());
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @dataProvider mockProvider
* @param Plan $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PlanTest::getJson()
));
$result = $obj->get("planId", $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Plan $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Plan $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$patchRequest = PatchRequestTest::getObject();
$result = $obj->update($patchRequest, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Plan $obj
*/
public function testList($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PlanListTest::getJson()
));
$params = ParamsTest::getObject();
$result = $obj->all($params, $mockApiContext, $mockPayPalRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}
@@ -0,0 +1,62 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PotentialPayerInfo;
/**
* Class PotentialPayerInfo
*
* @package PayPal\Test\Api
*/
class PotentialPayerInfoTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PotentialPayerInfo
* @return string
*/
public static function getJson()
{
return '{"email":"TestSample","external_remember_me_id":"TestSample","account_number":"TestSample","billing_address":' .AddressTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PotentialPayerInfo
*/
public static function getObject()
{
return new PotentialPayerInfo(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PotentialPayerInfo
*/
public function testSerializationDeserialization()
{
$obj = new PotentialPayerInfo(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getEmail());
$this->assertNotNull($obj->getExternalRememberMeId());
$this->assertNotNull($obj->getAccountNumber());
$this->assertNotNull($obj->getBillingAddress());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PotentialPayerInfo $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getEmail(), "TestSample");
$this->assertEquals($obj->getExternalRememberMeId(), "TestSample");
$this->assertEquals($obj->getAccountNumber(), "TestSample");
$this->assertEquals($obj->getBillingAddress(), AddressTest::getObject());
}
}
@@ -0,0 +1,59 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Presentation;
/**
* Class Presentation
*
* @package PayPal\Test\Api
*/
class PresentationTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Presentation
* @return string
*/
public static function getJson()
{
return json_encode(json_decode('{"brand_name":"TestSample","logo_image":"TestSample","locale_code":"TestSample"}'));
}
/**
* Gets Object Instance with Json data filled in
* @return Presentation
*/
public static function getObject()
{
return new Presentation(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Presentation
*/
public function testSerializationDeserialization()
{
$obj = new Presentation(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getBrandName());
$this->assertNotNull($obj->getLogoImage());
$this->assertNotNull($obj->getLocaleCode());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Presentation $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getBrandName(), "TestSample");
$this->assertEquals($obj->getLogoImage(), "TestSample");
$this->assertEquals($obj->getLocaleCode(), "TestSample");
}
}
@@ -0,0 +1,64 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\PrivateLabelCard;
/**
* Class PrivateLabelCard
*
* @package PayPal\Test\Api
*/
class PrivateLabelCardTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PrivateLabelCard
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","card_number":"TestSample","issuer_id":"TestSample","issuer_name":"TestSample","image_key":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return PrivateLabelCard
*/
public static function getObject()
{
return new PrivateLabelCard(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PrivateLabelCard
*/
public function testSerializationDeserialization()
{
$obj = new PrivateLabelCard(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getCardNumber());
$this->assertNotNull($obj->getIssuerId());
$this->assertNotNull($obj->getIssuerName());
$this->assertNotNull($obj->getImageKey());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PrivateLabelCard $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getCardNumber(), "TestSample");
$this->assertEquals($obj->getIssuerId(), "TestSample");
$this->assertEquals($obj->getIssuerName(), "TestSample");
$this->assertEquals($obj->getImageKey(), "TestSample");
}
}
@@ -0,0 +1,66 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\ProcessorResponse;
/**
* Class ProcessorResponse
*
* @package PayPal\Test\Api
*/
class ProcessorResponseTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object ProcessorResponse
* @return string
*/
public static function getJson()
{
return '{"response_code":"TestSample","avs_code":"TestSample","cvv_code":"TestSample","advice_code":"TestSample","eci_submitted":"TestSample","vpas":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return ProcessorResponse
*/
public static function getObject()
{
return new ProcessorResponse(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return ProcessorResponse
*/
public function testSerializationDeserialization()
{
$obj = new ProcessorResponse(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getResponseCode());
$this->assertNotNull($obj->getAvsCode());
$this->assertNotNull($obj->getCvvCode());
$this->assertNotNull($obj->getAdviceCode());
$this->assertNotNull($obj->getEciSubmitted());
$this->assertNotNull($obj->getVpas());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param ProcessorResponse $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getResponseCode(), "TestSample");
$this->assertEquals($obj->getAvsCode(), "TestSample");
$this->assertEquals($obj->getCvvCode(), "TestSample");
$this->assertEquals($obj->getAdviceCode(), "TestSample");
$this->assertEquals($obj->getEciSubmitted(), "TestSample");
$this->assertEquals($obj->getVpas(), "TestSample");
}
}
@@ -0,0 +1,69 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\RecipientBankingInstruction;
/**
* Class RecipientBankingInstruction
*
* @package PayPal\Test\Api
*/
class RecipientBankingInstructionTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object RecipientBankingInstruction
*
* @return string
*/
public static function getJson()
{
return '{"bank_name":"TestSample","account_holder_name":"TestSample","account_number":"TestSample","routing_number":"TestSample","international_bank_account_number":"TestSample","bank_identifier_code":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return RecipientBankingInstruction
*/
public static function getObject()
{
return new RecipientBankingInstruction(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return RecipientBankingInstruction
*/
public function testSerializationDeserialization()
{
$obj = new RecipientBankingInstruction(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getBankName());
$this->assertNotNull($obj->getAccountHolderName());
$this->assertNotNull($obj->getAccountNumber());
$this->assertNotNull($obj->getRoutingNumber());
$this->assertNotNull($obj->getInternationalBankAccountNumber());
$this->assertNotNull($obj->getBankIdentifierCode());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param RecipientBankingInstruction $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getBankName(), "TestSample");
$this->assertEquals($obj->getAccountHolderName(), "TestSample");
$this->assertEquals($obj->getAccountNumber(), "TestSample");
$this->assertEquals($obj->getRoutingNumber(), "TestSample");
$this->assertEquals($obj->getInternationalBankAccountNumber(), "TestSample");
$this->assertEquals($obj->getBankIdentifierCode(), "TestSample");
}
}
@@ -0,0 +1,80 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\RedirectUrls;
/**
* Class RedirectUrls
*
* @package PayPal\Test\Api
*/
class RedirectUrlsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object RedirectUrls
*
* @return string
*/
public static function getJson()
{
return '{"return_url":"http://www.google.com","cancel_url":"http://www.google.com"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return RedirectUrls
*/
public static function getObject()
{
return new RedirectUrls(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return RedirectUrls
*/
public function testSerializationDeserialization()
{
$obj = new RedirectUrls(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getReturnUrl());
$this->assertNotNull($obj->getCancelUrl());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param RedirectUrls $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getReturnUrl(), "http://www.google.com");
$this->assertEquals($obj->getCancelUrl(), "http://www.google.com");
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage ReturnUrl is not a fully qualified URL
*/
public function testUrlValidationForReturnUrl()
{
$obj = new RedirectUrls();
$obj->setReturnUrl(null);
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage CancelUrl is not a fully qualified URL
*/
public function testUrlValidationForCancelUrl()
{
$obj = new RedirectUrls();
$obj->setCancelUrl(null);
}
}
@@ -0,0 +1,59 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\RefundDetail;
/**
* Class RefundDetail
*
* @package PayPal\Test\Api
*/
class RefundDetailTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object RefundDetail
* @return string
*/
public static function getJson()
{
return '{"type":"TestSample","date":"TestSample","note":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return RefundDetail
*/
public static function getObject()
{
return new RefundDetail(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return RefundDetail
*/
public function testSerializationDeserialization()
{
$obj = new RefundDetail(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getDate());
$this->assertNotNull($obj->getNote());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param RefundDetail $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getDate(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
}
}
@@ -0,0 +1,109 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Refund;
/**
* Class Refund
*
* @package PayPal\Test\Api
*/
class RefundTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Refund
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","amount":' . AmountTest::getJson() . ',"state":"TestSample","reason":"TestSample","sale_id":"TestSample","capture_id":"TestSample","parent_payment":"TestSample","description":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Refund
*/
public static function getObject()
{
return new Refund(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return Refund
*/
public function testSerializationDeserialization()
{
$obj = new Refund(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getReason());
$this->assertNotNull($obj->getSaleId());
$this->assertNotNull($obj->getCaptureId());
$this->assertNotNull($obj->getParentPayment());
$this->assertNotNull($obj->getDescription());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Refund $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getAmount(), AmountTest::getObject());
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getReason(), "TestSample");
$this->assertEquals($obj->getSaleId(), "TestSample");
$this->assertEquals($obj->getCaptureId(), "TestSample");
$this->assertEquals($obj->getParentPayment(), "TestSample");
$this->assertEquals($obj->getDescription(), "TestSample");
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @dataProvider mockProvider
* @param Refund $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
RefundTest::getJson()
));
$result = $obj->get("refundId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}

Some files were not shown because too many files have changed in this diff Show More