Enabled Billing Plans and Agreements APIs

- Added API Classes, Samples, and Tests
- Updated Functional Tests
- Updated Documentation with new SDK Name
- Updated Few Samples to use newer nicer result page
This commit is contained in:
japatel
2014-10-31 10:16:13 -05:00
parent f55fd3d984
commit 4d481ad104
192 changed files with 13310 additions and 1045 deletions

View File

@@ -1,59 +1,108 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Address;
/**
* Class Address
*
* @package PayPal\Test\Api
*/
class AddressTest extends \PHPUnit_Framework_TestCase
{
/** @var Address */
private $address;
public static $line1 = "3909 Witmer Road";
public static $line2 = "Niagara Falls";
public static $city = "Niagara Falls";
public static $state = "NY";
public static $postalCode = "14305";
public static $countryCode = "US";
public static $phone = "716-298-1822";
public static $type = "Billing";
public static function createAddress()
/**
* Gets Json String of Object Address
* @return string
*/
public static function getJson()
{
$addr = new Address();
$addr->setLine1(self::$line1);
$addr->setLine2(self::$line2);
$addr->setCity(self::$city);
$addr->setState(self::$state);
$addr->setPostalCode(self::$postalCode);
$addr->setCountryCode(self::$countryCode);
$addr->setPhone(self::$phone);
return $addr;
return '{"line1":"TestSample","line2":"TestSample","city":"TestSample","country_code":"TestSample","postal_code":"TestSample","state":"TestSample","phone":"TestSample"}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return Address
*/
public static function getObject()
{
$this->address = self::createAddress();
return new Address(self::getJson());
}
public function testGetterSetter()
/**
* Tests for Serialization and Deserialization Issues
* @return Address
*/
public function testSerializationDeserialization()
{
$this->assertEquals(self::$line1, $this->address->getLine1());
$this->assertEquals(self::$line2, $this->address->getLine2());
$this->assertEquals(self::$city, $this->address->getCity());
$this->assertEquals(self::$state, $this->address->getState());
$this->assertEquals(self::$postalCode, $this->address->getPostalCode());
$this->assertEquals(self::$countryCode, $this->address->getCountryCode());
$this->assertEquals(self::$phone, $this->address->getPhone());
$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->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param Address $obj
*/
public function testGetters($obj)
{
$a1 = $this->address;
$a2 = new Address();
$a2->fromJson($a1->toJson());
$this->assertEquals($a1, $a2);
$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");
}
/**
* @depends testSerializationDeserialization
* @param Address $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCountry_code(), "TestSample");
$this->assertEquals($obj->getPostal_code(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Address $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Country_code
$obj->setCountryCode(null);
$this->assertNull($obj->getCountry_code());
$this->assertNull($obj->getCountryCode());
$this->assertSame($obj->getCountryCode(), $obj->getCountry_code());
$obj->setCountry_code("TestSample");
$this->assertEquals($obj->getCountry_code(), "TestSample");
// Check for Postal_code
$obj->setPostalCode(null);
$this->assertNull($obj->getPostal_code());
$this->assertNull($obj->getPostalCode());
$this->assertSame($obj->getPostalCode(), $obj->getPostal_code());
$obj->setPostal_code("TestSample");
$this->assertEquals($obj->getPostal_code(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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());
}
/**
* @depends testSerializationDeserialization
* @param AgreementStateDescriptor $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param AgreementStateDescriptor $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,367 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\ResourceModel;
use PayPal\Validation\ArgumentValidator;
use PayPal\Api\AgreementTransactions;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PPRestCall;
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","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());
}
/**
* @depends testSerializationDeserialization
* @param Agreement $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getStart_date(), "TestSample");
$this->assertEquals($obj->getShipping_address(), AddressTest::getObject());
$this->assertEquals($obj->getOverride_merchant_preferences(), MerchantPreferencesTest::getObject());
$this->assertEquals($obj->getOverride_charge_models(), OverrideChargeModelTest::getObject());
$this->assertEquals($obj->getCreate_time(), "TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Agreement $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Start_date
$obj->setStartDate(null);
$this->assertNull($obj->getStart_date());
$this->assertNull($obj->getStartDate());
$this->assertSame($obj->getStartDate(), $obj->getStart_date());
$obj->setStart_date("TestSample");
$this->assertEquals($obj->getStart_date(), "TestSample");
// Check for Shipping_address
$obj->setShippingAddress(null);
$this->assertNull($obj->getShipping_address());
$this->assertNull($obj->getShippingAddress());
$this->assertSame($obj->getShippingAddress(), $obj->getShipping_address());
$obj->setShipping_address(AddressTest::getObject());
$this->assertEquals($obj->getShipping_address(), AddressTest::getObject());
// Check for Override_merchant_preferences
$obj->setOverrideMerchantPreferences(null);
$this->assertNull($obj->getOverride_merchant_preferences());
$this->assertNull($obj->getOverrideMerchantPreferences());
$this->assertSame($obj->getOverrideMerchantPreferences(), $obj->getOverride_merchant_preferences());
$obj->setOverride_merchant_preferences(MerchantPreferencesTest::getObject());
$this->assertEquals($obj->getOverride_merchant_preferences(), MerchantPreferencesTest::getObject());
// Check for Override_charge_models
$obj->setOverrideChargeModels(null);
$this->assertNull($obj->getOverride_charge_models());
$this->assertNull($obj->getOverrideChargeModels());
$this->assertSame($obj->getOverrideChargeModels(), $obj->getOverride_charge_models());
$obj->setOverride_charge_models(OverrideChargeModelTest::getObject());
$this->assertEquals($obj->getOverride_charge_models(), OverrideChargeModelTest::getObject());
// Check for Create_time
$obj->setCreateTime(null);
$this->assertNull($obj->getCreate_time());
$this->assertNull($obj->getCreateTime());
$this->assertSame($obj->getCreateTime(), $obj->getCreate_time());
$obj->setCreate_time("TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
// Check for Update_time
$obj->setUpdateTime(null);
$this->assertNull($obj->getUpdate_time());
$this->assertNull($obj->getUpdateTime());
$this->assertSame($obj->getUpdateTime(), $obj->getUpdate_time());
$obj->setUpdate_time("TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testExecute($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->execute("123123", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
AgreementTest::getJson()
));
$result = $obj->get("agreementId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$patchRequest = PatchRequestTest::getObject();
$result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testSuspend($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->suspend($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testReActivate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->reActivate($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testCancel($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->cancel($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testBillBalance($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->billBalance($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testSetBalance($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$currency = CurrencyTest::getObject();
$result = $obj->setBalance($currency, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testTransactions($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
AgreementTransactionsTest::getJson()
));
$result = $obj->transactions("agreementId", $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)
);
}
}

View File

@@ -0,0 +1,168 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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_updated":"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->getTimeUpdated());
$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->getTimeUpdated(), "TestSample");
$this->assertEquals($obj->getTimeZone(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransaction $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getTransaction_id(), "TestSample");
$this->assertEquals($obj->getTransaction_type(), "TestSample");
$this->assertEquals($obj->getFee_amount(), CurrencyTest::getObject());
$this->assertEquals($obj->getNet_amount(), CurrencyTest::getObject());
$this->assertEquals($obj->getPayer_email(), "TestSample");
$this->assertEquals($obj->getPayer_name(), "TestSample");
$this->assertEquals($obj->getTime_updated(), "TestSample");
$this->assertEquals($obj->getTime_zone(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransaction $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Transaction_id
$obj->setTransactionId(null);
$this->assertNull($obj->getTransaction_id());
$this->assertNull($obj->getTransactionId());
$this->assertSame($obj->getTransactionId(), $obj->getTransaction_id());
$obj->setTransaction_id("TestSample");
$this->assertEquals($obj->getTransaction_id(), "TestSample");
// Check for Transaction_type
$obj->setTransactionType(null);
$this->assertNull($obj->getTransaction_type());
$this->assertNull($obj->getTransactionType());
$this->assertSame($obj->getTransactionType(), $obj->getTransaction_type());
$obj->setTransaction_type("TestSample");
$this->assertEquals($obj->getTransaction_type(), "TestSample");
// Check for Fee_amount
$obj->setFeeAmount(null);
$this->assertNull($obj->getFee_amount());
$this->assertNull($obj->getFeeAmount());
$this->assertSame($obj->getFeeAmount(), $obj->getFee_amount());
$obj->setFee_amount(CurrencyTest::getObject());
$this->assertEquals($obj->getFee_amount(), CurrencyTest::getObject());
// Check for Net_amount
$obj->setNetAmount(null);
$this->assertNull($obj->getNet_amount());
$this->assertNull($obj->getNetAmount());
$this->assertSame($obj->getNetAmount(), $obj->getNet_amount());
$obj->setNet_amount(CurrencyTest::getObject());
$this->assertEquals($obj->getNet_amount(), CurrencyTest::getObject());
// Check for Payer_email
$obj->setPayerEmail(null);
$this->assertNull($obj->getPayer_email());
$this->assertNull($obj->getPayerEmail());
$this->assertSame($obj->getPayerEmail(), $obj->getPayer_email());
$obj->setPayer_email("TestSample");
$this->assertEquals($obj->getPayer_email(), "TestSample");
// Check for Payer_name
$obj->setPayerName(null);
$this->assertNull($obj->getPayer_name());
$this->assertNull($obj->getPayerName());
$this->assertSame($obj->getPayerName(), $obj->getPayer_name());
$obj->setPayer_name("TestSample");
$this->assertEquals($obj->getPayer_name(), "TestSample");
// Check for Time_updated
$obj->setTimeUpdated(null);
$this->assertNull($obj->getTime_updated());
$this->assertNull($obj->getTimeUpdated());
$this->assertSame($obj->getTimeUpdated(), $obj->getTime_updated());
$obj->setTime_updated("TestSample");
$this->assertEquals($obj->getTime_updated(), "TestSample");
// Check for Time_zone
$obj->setTimeZone(null);
$this->assertNull($obj->getTime_zone());
$this->assertNull($obj->getTimeZone());
$this->assertSame($obj->getTimeZone(), $obj->getTime_zone());
$obj->setTime_zone("TestSample");
$this->assertEquals($obj->getTime_zone(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,87 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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());
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransactions $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getAgreement_transaction_list(), AgreementTransactionTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransactions $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Agreement_transaction_list
$obj->setAgreementTransactionList(null);
$this->assertNull($obj->getAgreement_transaction_list());
$this->assertNull($obj->getAgreementTransactionList());
$this->assertSame($obj->getAgreementTransactionList(), $obj->getAgreement_transaction_list());
$obj->setAgreement_transaction_list(AgreementTransactionTest::getObject());
$this->assertEquals($obj->getAgreement_transaction_list(), AgreementTransactionTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -41,7 +41,7 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
$authorization->setClearingTime(self::$clearing_time);
$authorization->setAmount(AmountTest::createAmount());
$authorization->setLinks(array(LinksTest::createLinks()));
$authorization->setLinks(array(LinksTest::getObject()));
return $authorization;
}

View File

@@ -0,0 +1,404 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\ResourceModel;
use PayPal\Validation\ArgumentValidator;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PPRestCall;
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());
}
/**
* @depends testSerializationDeserialization
* @param BankAccount $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getAccount_number(), "TestSample");
$this->assertEquals($obj->getAccount_number_type(), "TestSample");
$this->assertEquals($obj->getRouting_number(), "TestSample");
$this->assertEquals($obj->getAccount_type(), "TestSample");
$this->assertEquals($obj->getAccount_name(), "TestSample");
$this->assertEquals($obj->getCheck_type(), "TestSample");
$this->assertEquals($obj->getAuth_type(), "TestSample");
$this->assertEquals($obj->getAuth_capture_timestamp(), "TestSample");
$this->assertEquals($obj->getBank_name(), "TestSample");
$this->assertEquals($obj->getCountry_code(), "TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
$this->assertEquals($obj->getBirth_date(), "TestSample");
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
$this->assertEquals($obj->getConfirmation_status(), "TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
$this->assertEquals($obj->getMerchant_id(), "TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param BankAccount $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Account_number
$obj->setAccountNumber(null);
$this->assertNull($obj->getAccount_number());
$this->assertNull($obj->getAccountNumber());
$this->assertSame($obj->getAccountNumber(), $obj->getAccount_number());
$obj->setAccount_number("TestSample");
$this->assertEquals($obj->getAccount_number(), "TestSample");
// Check for Account_number_type
$obj->setAccountNumberType(null);
$this->assertNull($obj->getAccount_number_type());
$this->assertNull($obj->getAccountNumberType());
$this->assertSame($obj->getAccountNumberType(), $obj->getAccount_number_type());
$obj->setAccount_number_type("TestSample");
$this->assertEquals($obj->getAccount_number_type(), "TestSample");
// Check for Routing_number
$obj->setRoutingNumber(null);
$this->assertNull($obj->getRouting_number());
$this->assertNull($obj->getRoutingNumber());
$this->assertSame($obj->getRoutingNumber(), $obj->getRouting_number());
$obj->setRouting_number("TestSample");
$this->assertEquals($obj->getRouting_number(), "TestSample");
// Check for Account_type
$obj->setAccountType(null);
$this->assertNull($obj->getAccount_type());
$this->assertNull($obj->getAccountType());
$this->assertSame($obj->getAccountType(), $obj->getAccount_type());
$obj->setAccount_type("TestSample");
$this->assertEquals($obj->getAccount_type(), "TestSample");
// Check for Account_name
$obj->setAccountName(null);
$this->assertNull($obj->getAccount_name());
$this->assertNull($obj->getAccountName());
$this->assertSame($obj->getAccountName(), $obj->getAccount_name());
$obj->setAccount_name("TestSample");
$this->assertEquals($obj->getAccount_name(), "TestSample");
// Check for Check_type
$obj->setCheckType(null);
$this->assertNull($obj->getCheck_type());
$this->assertNull($obj->getCheckType());
$this->assertSame($obj->getCheckType(), $obj->getCheck_type());
$obj->setCheck_type("TestSample");
$this->assertEquals($obj->getCheck_type(), "TestSample");
// Check for Auth_type
$obj->setAuthType(null);
$this->assertNull($obj->getAuth_type());
$this->assertNull($obj->getAuthType());
$this->assertSame($obj->getAuthType(), $obj->getAuth_type());
$obj->setAuth_type("TestSample");
$this->assertEquals($obj->getAuth_type(), "TestSample");
// Check for Auth_capture_timestamp
$obj->setAuthCaptureTimestamp(null);
$this->assertNull($obj->getAuth_capture_timestamp());
$this->assertNull($obj->getAuthCaptureTimestamp());
$this->assertSame($obj->getAuthCaptureTimestamp(), $obj->getAuth_capture_timestamp());
$obj->setAuth_capture_timestamp("TestSample");
$this->assertEquals($obj->getAuth_capture_timestamp(), "TestSample");
// Check for Bank_name
$obj->setBankName(null);
$this->assertNull($obj->getBank_name());
$this->assertNull($obj->getBankName());
$this->assertSame($obj->getBankName(), $obj->getBank_name());
$obj->setBank_name("TestSample");
$this->assertEquals($obj->getBank_name(), "TestSample");
// Check for Country_code
$obj->setCountryCode(null);
$this->assertNull($obj->getCountry_code());
$this->assertNull($obj->getCountryCode());
$this->assertSame($obj->getCountryCode(), $obj->getCountry_code());
$obj->setCountry_code("TestSample");
$this->assertEquals($obj->getCountry_code(), "TestSample");
// Check for First_name
$obj->setFirstName(null);
$this->assertNull($obj->getFirst_name());
$this->assertNull($obj->getFirstName());
$this->assertSame($obj->getFirstName(), $obj->getFirst_name());
$obj->setFirst_name("TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
// Check for Last_name
$obj->setLastName(null);
$this->assertNull($obj->getLast_name());
$this->assertNull($obj->getLastName());
$this->assertSame($obj->getLastName(), $obj->getLast_name());
$obj->setLast_name("TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
// Check for Birth_date
$obj->setBirthDate(null);
$this->assertNull($obj->getBirth_date());
$this->assertNull($obj->getBirthDate());
$this->assertSame($obj->getBirthDate(), $obj->getBirth_date());
$obj->setBirth_date("TestSample");
$this->assertEquals($obj->getBirth_date(), "TestSample");
// Check for Billing_address
$obj->setBillingAddress(null);
$this->assertNull($obj->getBilling_address());
$this->assertNull($obj->getBillingAddress());
$this->assertSame($obj->getBillingAddress(), $obj->getBilling_address());
$obj->setBilling_address(AddressTest::getObject());
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
// Check for Confirmation_status
$obj->setConfirmationStatus(null);
$this->assertNull($obj->getConfirmation_status());
$this->assertNull($obj->getConfirmationStatus());
$this->assertSame($obj->getConfirmationStatus(), $obj->getConfirmation_status());
$obj->setConfirmation_status("TestSample");
$this->assertEquals($obj->getConfirmation_status(), "TestSample");
// Check for Payer_id
$obj->setPayerId(null);
$this->assertNull($obj->getPayer_id());
$this->assertNull($obj->getPayerId());
$this->assertSame($obj->getPayerId(), $obj->getPayer_id());
$obj->setPayer_id("TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
// Check for External_customer_id
$obj->setExternalCustomerId(null);
$this->assertNull($obj->getExternal_customer_id());
$this->assertNull($obj->getExternalCustomerId());
$this->assertSame($obj->getExternalCustomerId(), $obj->getExternal_customer_id());
$obj->setExternal_customer_id("TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
// Check for Merchant_id
$obj->setMerchantId(null);
$this->assertNull($obj->getMerchant_id());
$this->assertNull($obj->getMerchantId());
$this->assertSame($obj->getMerchantId(), $obj->getMerchant_id());
$obj->setMerchant_id("TestSample");
$this->assertEquals($obj->getMerchant_id(), "TestSample");
// Check for Create_time
$obj->setCreateTime(null);
$this->assertNull($obj->getCreate_time());
$this->assertNull($obj->getCreateTime());
$this->assertSame($obj->getCreateTime(), $obj->getCreate_time());
$obj->setCreate_time("TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
// Check for Update_time
$obj->setUpdateTime(null);
$this->assertNull($obj->getUpdate_time());
$this->assertNull($obj->getUpdateTime());
$this->assertSame($obj->getUpdateTime(), $obj->getUpdate_time());
$obj->setUpdate_time("TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
// Check for Valid_until
$obj->setValidUntil(null);
$this->assertNull($obj->getValid_until());
$this->assertNull($obj->getValidUntil());
$this->assertSame($obj->getValidUntil(), $obj->getValid_until());
$obj->setValid_until("TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @dataProvider mockProvider
* @param BankAccount $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param BankAccount $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
BankAccountTest::getJson()
));
$result = $obj->get("bankAccountId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param BankAccount $obj
*/
public function testDelete($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$result = $obj->delete($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param BankAccount $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$patchRequest = PatchRequestTest::getObject();
$result = $obj->update($patchRequest, $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)
);
}
}

View File

@@ -0,0 +1,100 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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");
}
/**
* @depends testSerializationDeserialization
* @param BankAccountsList $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getBank_accounts(), BankAccountTest::getObject());
$this->assertEquals($obj->getNext_id(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param BankAccountsList $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Bank_accounts
$obj->setBankAccounts(null);
$this->assertNull($obj->getBank_accounts());
$this->assertNull($obj->getBankAccounts());
$this->assertSame($obj->getBankAccounts(), $obj->getBank_accounts());
$obj->setBank_accounts(BankAccountTest::getObject());
$this->assertEquals($obj->getBank_accounts(), BankAccountTest::getObject());
// Check for Next_id
$obj->setNextId(null);
$this->assertNull($obj->getNext_id());
$this->assertNull($obj->getNextId());
$this->assertSame($obj->getNextId(), $obj->getNext_id());
$obj->setNext_id("TestSample");
$this->assertEquals($obj->getNext_id(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,109 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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");
}
/**
* @depends testSerializationDeserialization
* @param BankToken $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getBank_id(), "TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
$this->assertEquals($obj->getMandate_reference_number(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param BankToken $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Bank_id
$obj->setBankId(null);
$this->assertNull($obj->getBank_id());
$this->assertNull($obj->getBankId());
$this->assertSame($obj->getBankId(), $obj->getBank_id());
$obj->setBank_id("TestSample");
$this->assertEquals($obj->getBank_id(), "TestSample");
// Check for External_customer_id
$obj->setExternalCustomerId(null);
$this->assertNull($obj->getExternal_customer_id());
$this->assertNull($obj->getExternalCustomerId());
$this->assertSame($obj->getExternalCustomerId(), $obj->getExternal_customer_id());
$obj->setExternal_customer_id("TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
// Check for Mandate_reference_number
$obj->setMandateReferenceNumber(null);
$this->assertNull($obj->getMandate_reference_number());
$this->assertNull($obj->getMandateReferenceNumber());
$this->assertSame($obj->getMandateReferenceNumber(), $obj->getMandate_reference_number());
$obj->setMandate_reference_number("TestSample");
$this->assertEquals($obj->getMandate_reference_number(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -5,6 +5,7 @@ use PayPal\Api\Capture;
use PayPal\Api\Refund;
use PayPal\Api\Authorization;
use PayPal\Api\Amount;
use PayPal\Exception\PPConnectionException;
use PayPal\Test\Constants;
class CaptureTest extends \PHPUnit_Framework_TestCase
@@ -35,7 +36,7 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
$capture = self::createCapture();
$capture->setAmount(AmountTest::createAmount());
$capture->setLinks(array(LinksTest::createLinks()));
$capture->setLinks(array(LinksTest::getObject()));
$this->captures['full'] = $capture;
}
@@ -48,7 +49,6 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(AmountTest::$currency, $this->captures['full']->getAmount()->getCurrency());
$links = $this->captures['full']->getLinks();
$this->assertEquals(LinksTest::$href, $links[0]->getHref());
}
public function testSerializeDeserialize()
@@ -98,4 +98,4 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
}
}
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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());
}
/**
* @depends testSerializationDeserialization
* @param ChargeModel $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param ChargeModel $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -44,8 +44,8 @@ class CreditCardHistoryTest extends \PHPUnit_Framework_TestCase
{
$card = self::createCreditCard();
$card->setBillingAddress(AddressTest::createAddress());
$card->setLinks(array(LinksTest::createLinks()));
$card->setBillingAddress(AddressTest::getObject());
$card->setLinks(array(LinksTest::getObject()));
$this->cards['full'] = $card;
$card = self::createCreditCard();
@@ -73,4 +73,4 @@ class CreditCardHistoryTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($cardHistory, $cardHistoryCopy);
}
}
}

View File

@@ -0,0 +1,100 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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 '{"credit-cards":' .CreditCardTest::getJson() . ',"count":123,"next_id":"TestSample"}';
}
/**
* 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->getCreditCards());
$this->assertNotNull($obj->getCount());
$this->assertNotNull($obj->getNextId());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CreditCardList $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCreditCards(), CreditCardTest::getObject());
$this->assertEquals($obj->getCount(), 123);
$this->assertEquals($obj->getNextId(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param CreditCardList $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCredit_cards(), CreditCardTest::getObject());
$this->assertEquals($obj->getNext_id(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param CreditCardList $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Credit_cards
$obj->setCreditCards(null);
$this->assertNull($obj->getCredit_cards());
$this->assertNull($obj->getCreditCards());
$this->assertSame($obj->getCreditCards(), $obj->getCredit_cards());
$obj->setCredit_cards(CreditCardTest::getObject());
$this->assertEquals($obj->getCredit_cards(), CreditCardTest::getObject());
// Check for Next_id
$obj->setNextId(null);
$this->assertNull($obj->getNext_id());
$this->assertNull($obj->getNextId());
$this->assertSame($obj->getNextId(), $obj->getNext_id());
$obj->setNext_id("TestSample");
$this->assertEquals($obj->getNext_id(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -1,101 +1,277 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Address;
use PayPal\Common\ResourceModel;
use PayPal\Validation\ArgumentValidator;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PPRestCall;
use PayPal\Api\CreditCard;
use PayPal\Api\Links;
use PayPal\Test\Constants;
/**
* Class CreditCard
*
* @package PayPal\Test\Api
*/
class CreditCardTest 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()
/**
* Gets Json String of Object CreditCard
* @return string
*/
public static function getJson()
{
$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);
return $card;
}
public function setup()
{
$card = self::createCreditCard();
$card->setBillingAddress(AddressTest::createAddress());
$card->setLinks(array(LinksTest::createLinks()));
$this->cards['full'] = $card;
$card = self::createCreditCard();
$this->cards['partial'] = $card;
}
public function testGetterSetters()
{
/** @var CreditCard $c */
$c = $this->cards['partial'];
$this->assertEquals(self::$cardType, $c->getType());
$this->assertEquals(self::$cardNumber, $c->getNumber());
$this->assertEquals(self::$expireMonth, $c->getExpireMonth());
$this->assertEquals(self::$expireYear, $c->getExpireYear());
$this->assertEquals(self::$cvv, $c->getCvv2());
$this->assertEquals(self::$firstName, $c->getFirstName());
$this->assertEquals(self::$lastName, $c->getLastName());
$c = $this->cards['full'];
$this->assertEquals(AddressTest::$line1, $c->getBillingAddress()->getLine1());
/** @var Links[] $link */
$link = $c->getLinks();
$this->assertEquals(LinksTest::$href, $link[0]->getHref());
}
public function testSerializeDeserialize()
{
/** @var CreditCard $c1 */
$c1 = $this->cards['full'];
$json = $c1->toJson();
$c2 = new CreditCard();
$c2->fromJson($json);
$this->assertEquals($c1, $c2);
return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"cvv2":123,"first_name":"TestSample","last_name":"TestSample","billing_address":' .AddressTest::getJson() . ',"external_customer_id":"TestSample","state":"TestSample","valid_until":"TestSample","create_time":"TestSample","update_time":"TestSample"}';
}
/**
* @group integration
* Gets Object Instance with Json data filled in
* @return CreditCard
*/
public function testOperations()
public static function getObject()
{
/** @var CreditCard $c1 */
$c1 = $this->cards['full'];
$c1->create();
$this->assertNotNull($c1->getId());
$c2 = CreditCard::get($c1->getId());
$this->assertEquals($c1->getBillingAddress(), $c2->getBillingAddress());
$this->assertGreaterThan(0, count($c2->getLinks()));
$this->assertEquals(self::$cardType, $c2->getType());
$this->assertNotNull($c2->getState());
$this->assertEquals(true, $c2->delete());
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->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$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(), 123);
$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->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param CreditCard $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getExpire_month(), 123);
$this->assertEquals($obj->getExpire_year(), 123);
$this->assertEquals($obj->getFirst_name(), "TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param CreditCard $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Expire_month
$obj->setExpireMonth(null);
$this->assertNull($obj->getExpire_month());
$this->assertNull($obj->getExpireMonth());
$this->assertSame($obj->getExpireMonth(), $obj->getExpire_month());
$obj->setExpire_month(123);
$this->assertEquals($obj->getExpire_month(), 123);
// Check for Expire_year
$obj->setExpireYear(null);
$this->assertNull($obj->getExpire_year());
$this->assertNull($obj->getExpireYear());
$this->assertSame($obj->getExpireYear(), $obj->getExpire_year());
$obj->setExpire_year(123);
$this->assertEquals($obj->getExpire_year(), 123);
// Check for First_name
$obj->setFirstName(null);
$this->assertNull($obj->getFirst_name());
$this->assertNull($obj->getFirstName());
$this->assertSame($obj->getFirstName(), $obj->getFirst_name());
$obj->setFirst_name("TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
// Check for Last_name
$obj->setLastName(null);
$this->assertNull($obj->getLast_name());
$this->assertNull($obj->getLastName());
$this->assertSame($obj->getLastName(), $obj->getLast_name());
$obj->setLast_name("TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
// Check for Billing_address
$obj->setBillingAddress(null);
$this->assertNull($obj->getBilling_address());
$this->assertNull($obj->getBillingAddress());
$this->assertSame($obj->getBillingAddress(), $obj->getBilling_address());
$obj->setBilling_address(AddressTest::getObject());
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
// Check for External_customer_id
$obj->setExternalCustomerId(null);
$this->assertNull($obj->getExternal_customer_id());
$this->assertNull($obj->getExternalCustomerId());
$this->assertSame($obj->getExternalCustomerId(), $obj->getExternal_customer_id());
$obj->setExternal_customer_id("TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
// Check for Valid_until
$obj->setValidUntil(null);
$this->assertNull($obj->getValid_until());
$this->assertNull($obj->getValidUntil());
$this->assertSame($obj->getValidUntil(), $obj->getValid_until());
$obj->setValid_until("TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
// Check for Create_time
$obj->setCreateTime(null);
$this->assertNull($obj->getCreate_time());
$this->assertNull($obj->getCreateTime());
$this->assertSame($obj->getCreateTime(), $obj->getCreate_time());
$obj->setCreate_time("TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
// Check for Update_time
$obj->setUpdateTime(null);
$this->assertNull($obj->getUpdate_time());
$this->assertNull($obj->getUpdateTime());
$this->assertSame($obj->getUpdateTime(), $obj->getUpdate_time());
$obj->setUpdate_time("TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @dataProvider mockProvider
* @param CreditCard $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param CreditCard $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
CreditCardTest::getJson()
));
$result = $obj->get("creditCardId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param CreditCard $obj
*/
public function testDelete($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$result = $obj->delete($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param CreditCard $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->update($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)
);
}
}

View File

@@ -1,43 +1,124 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\CreditCardToken;
use PayPal\Test\Constants;
/**
* Class CreditCardToken
*
* @package PayPal\Test\Api
*/
class CreditCardTokenTest extends \PHPUnit_Framework_TestCase
{
private $ccToken;
public static $payerId = "PAYER-123";
public static $creditCardId = "CC-123";
public static function createCreditCardToken()
/**
* Gets Json String of Object CreditCardToken
* @return string
*/
public static function getJson()
{
$ccToken = new CreditCardToken();
$ccToken->setPayerId(self::$payerId);
$ccToken->setCreditCardId(self::$creditCardId);
return $ccToken;
return '{"credit_card_id":"TestSample","payer_id":"TestSample","last4":"TestSample","type":"TestSample","expire_month":123,"expire_year":123}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return CreditCardToken
*/
public static function getObject()
{
$this->ccToken = self::createCreditCardToken();
return new CreditCardToken(self::getJson());
}
public function testGetterSetter()
/**
* Tests for Serialization and Deserialization Issues
* @return CreditCardToken
*/
public function testSerializationDeserialization()
{
$this->assertEquals(self::$payerId, $this->ccToken->getPayerId());
$this->assertEquals(self::$creditCardId, $this->ccToken->getCreditCardId());
$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;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param CreditCardToken $obj
*/
public function testGetters($obj)
{
$t1 = $this->ccToken;
$t2 = new CreditCardToken();
$t2->fromJson($t1->toJson());
$this->assertEquals($t1, $t2);
$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);
}
}
/**
* @depends testSerializationDeserialization
* @param CreditCardToken $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCredit_card_id(), "TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
$this->assertEquals($obj->getExpire_month(), 123);
$this->assertEquals($obj->getExpire_year(), 123);
}
/**
* @depends testSerializationDeserialization
* @param CreditCardToken $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Credit_card_id
$obj->setCreditCardId(null);
$this->assertNull($obj->getCredit_card_id());
$this->assertNull($obj->getCreditCardId());
$this->assertSame($obj->getCreditCardId(), $obj->getCredit_card_id());
$obj->setCredit_card_id("TestSample");
$this->assertEquals($obj->getCredit_card_id(), "TestSample");
// Check for Payer_id
$obj->setPayerId(null);
$this->assertNull($obj->getPayer_id());
$this->assertNull($obj->getPayerId());
$this->assertSame($obj->getPayerId(), $obj->getPayer_id());
$obj->setPayer_id("TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
// Check for Expire_month
$obj->setExpireMonth(null);
$this->assertNull($obj->getExpire_month());
$this->assertNull($obj->getExpireMonth());
$this->assertSame($obj->getExpireMonth(), $obj->getExpire_month());
$obj->setExpire_month(123);
$this->assertEquals($obj->getExpire_month(), 123);
// Check for Expire_year
$obj->setExpireYear(null);
$this->assertNull($obj->getExpire_year());
$this->assertNull($obj->getExpireYear());
$this->assertSame($obj->getExpireYear(), $obj->getExpire_year());
$obj->setExpire_year(123);
$this->assertEquals($obj->getExpire_year(), 123);
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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","terms":"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->assertNotNull($obj->getTerms());
$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");
$this->assertEquals($obj->getTerms(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Credit $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param Credit $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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":"TestSample"}';
}
/**
* 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(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Currency $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param Currency $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,87 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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");
}
/**
* @depends testSerializationDeserialization
* @param ExtendedBankAccount $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getMandate_reference_number(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param ExtendedBankAccount $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Mandate_reference_number
$obj->setMandateReferenceNumber(null);
$this->assertNull($obj->getMandate_reference_number());
$this->assertNull($obj->getMandateReferenceNumber());
$this->assertSame($obj->getMandateReferenceNumber(), $obj->getMandate_reference_number());
$obj->setMandate_reference_number("TestSample");
$this->assertEquals($obj->getMandate_reference_number(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -2,40 +2,143 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\FundingInstrument;
use PayPal\Test\Constants;
/**
* Class FundingInstrument
*
* @package PayPal\Test\Api
*/
class FundingInstrumentTest extends \PHPUnit_Framework_TestCase
{
private $fi;
public static function createFundingInstrument()
/**
* Gets Json String of Object FundingInstrument
* @return string
*/
public static function getJson()
{
$fi = new FundingInstrument();
$fi->setCreditCard(CreditCardTest::createCreditCard());
$fi->setCreditCardToken(CreditCardTokenTest::createCreditCardToken());
return $fi;
return '{"credit_card":' .CreditCardTest::getJson() . ',"credit_card_token":' .CreditCardTokenTest::getJson() . ',"payment_card":' .PaymentCardTest::getJson() . ',"payment_card_token":' .PaymentCardTokenTest::getJson() . ',"bank_account":' .ExtendedBankAccountTest::getJson() . ',"bank_account_token":' .BankTokenTest::getJson() . ',"credit":' .CreditTest::getJson() . '}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return FundingInstrument
*/
public static function getObject()
{
$this->fi = self::createFundingInstrument();
return new FundingInstrument(self::getJson());
}
public function testGetterSetter()
/**
* Tests for Serialization and Deserialization Issues
* @return FundingInstrument
*/
public function testSerializationDeserialization()
{
$this->assertEquals(CreditCardTest::$cardNumber, $this->fi->getCreditCard()->getNumber());
$this->assertEquals(CreditCardTokenTest::$creditCardId,
$this->fi->getCreditCardToken()->getCreditCardId());
$obj = new FundingInstrument(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCreditCard());
$this->assertNotNull($obj->getCreditCardToken());
$this->assertNotNull($obj->getPaymentCard());
$this->assertNotNull($obj->getPaymentCardToken());
$this->assertNotNull($obj->getBankAccount());
$this->assertNotNull($obj->getBankAccountToken());
$this->assertNotNull($obj->getCredit());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param FundingInstrument $obj
*/
public function testGetters($obj)
{
$fi1 = $this->fi;
$fi2 = new FundingInstrument();
$fi2->fromJson($fi1->toJson());
$this->assertEquals($fi1, $fi2);
$this->assertEquals($obj->getCreditCard(), CreditCardTest::getObject());
$this->assertEquals($obj->getCreditCardToken(), CreditCardTokenTest::getObject());
$this->assertEquals($obj->getPaymentCard(), PaymentCardTest::getObject());
$this->assertEquals($obj->getPaymentCardToken(), PaymentCardTokenTest::getObject());
$this->assertEquals($obj->getBankAccount(), ExtendedBankAccountTest::getObject());
$this->assertEquals($obj->getBankAccountToken(), BankTokenTest::getObject());
$this->assertEquals($obj->getCredit(), CreditTest::getObject());
}
}
/**
* @depends testSerializationDeserialization
* @param FundingInstrument $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCredit_card(), CreditCardTest::getObject());
$this->assertEquals($obj->getCredit_card_token(), CreditCardTokenTest::getObject());
$this->assertEquals($obj->getPayment_card(), PaymentCardTest::getObject());
$this->assertEquals($obj->getPayment_card_token(), PaymentCardTokenTest::getObject());
$this->assertEquals($obj->getBank_account(), ExtendedBankAccountTest::getObject());
$this->assertEquals($obj->getBank_account_token(), BankTokenTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param FundingInstrument $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Credit_card
$obj->setCreditCard(null);
$this->assertNull($obj->getCredit_card());
$this->assertNull($obj->getCreditCard());
$this->assertSame($obj->getCreditCard(), $obj->getCredit_card());
$obj->setCredit_card(CreditCardTest::getObject());
$this->assertEquals($obj->getCredit_card(), CreditCardTest::getObject());
// Check for Credit_card_token
$obj->setCreditCardToken(null);
$this->assertNull($obj->getCredit_card_token());
$this->assertNull($obj->getCreditCardToken());
$this->assertSame($obj->getCreditCardToken(), $obj->getCredit_card_token());
$obj->setCredit_card_token(CreditCardTokenTest::getObject());
$this->assertEquals($obj->getCredit_card_token(), CreditCardTokenTest::getObject());
// Check for Payment_card
$obj->setPaymentCard(null);
$this->assertNull($obj->getPayment_card());
$this->assertNull($obj->getPaymentCard());
$this->assertSame($obj->getPaymentCard(), $obj->getPayment_card());
$obj->setPayment_card(PaymentCardTest::getObject());
$this->assertEquals($obj->getPayment_card(), PaymentCardTest::getObject());
// Check for Payment_card_token
$obj->setPaymentCardToken(null);
$this->assertNull($obj->getPayment_card_token());
$this->assertNull($obj->getPaymentCardToken());
$this->assertSame($obj->getPaymentCardToken(), $obj->getPayment_card_token());
$obj->setPayment_card_token(PaymentCardTokenTest::getObject());
$this->assertEquals($obj->getPayment_card_token(), PaymentCardTokenTest::getObject());
// Check for Bank_account
$obj->setBankAccount(null);
$this->assertNull($obj->getBank_account());
$this->assertNull($obj->getBankAccount());
$this->assertSame($obj->getBankAccount(), $obj->getBank_account());
$obj->setBank_account(ExtendedBankAccountTest::getObject());
$this->assertEquals($obj->getBank_account(), ExtendedBankAccountTest::getObject());
// Check for Bank_account_token
$obj->setBankAccountToken(null);
$this->assertNull($obj->getBank_account_token());
$this->assertNull($obj->getBankAccountToken());
$this->assertSame($obj->getBankAccountToken(), $obj->getBank_account_token());
$obj->setBank_account_token(BankTokenTest::getObject());
$this->assertEquals($obj->getBank_account_token(), BankTokenTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,88 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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");
}
/**
* @depends testSerializationDeserialization
* @param HyperSchema $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param HyperSchema $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -24,7 +24,7 @@ class ItemListTest extends \PHPUnit_Framework_TestCase
$itemList = new ItemList();
$itemList->setItems(array($item));
$itemList->setShippingAddress(ShippingAddressTest::createAddress());
$itemList->setShippingAddress(ShippingAddressTest::getObject());
return $itemList;
}
@@ -38,7 +38,7 @@ class ItemListTest extends \PHPUnit_Framework_TestCase
{
$items = $this->items->getItems();
$this->assertEquals(ItemTest::createItem(), $items[0]);
$this->assertEquals(ShippingAddressTest::createAddress(), $this->items->getShippingAddress());
$this->assertEquals(ShippingAddressTest::getObject(), $this->items->getShippingAddress());
}
public function testSerializeDeserialize()

View File

@@ -2,44 +2,87 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Links;
use PayPal\Test\Constants;
/**
* Class Links
*
* @package PayPal\Test\Api
*/
class LinksTest extends \PHPUnit_Framework_TestCase
{
private $links;
public static $href = "USD";
public static $rel = "1.12";
public static $method = "1.12";
public static function createLinks()
/**
* Gets Json String of Object Links
* @return string
*/
public static function getJson()
{
$links = new Links();
$links->setHref(self::$href);
$links->setRel(self::$rel);
$links->setMethod(self::$method);
return $links;
return '{"href":"TestSample","rel":"TestSample","targetSchema":' .HyperSchemaTest::getJson() . ',"method":"TestSample","enctype":"TestSample","schema":' .HyperSchemaTest::getJson() . '}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return Links
*/
public static function getObject()
{
$this->links = self::createLinks();
return new Links(self::getJson());
}
public function testGetterSetters()
/**
* Tests for Serialization and Deserialization Issues
* @return Links
*/
public function testSerializationDeserialization()
{
$this->assertEquals(self::$href, $this->links->getHref());
$this->assertEquals(self::$rel, $this->links->getRel());
$this->assertEquals(self::$method, $this->links->getMethod());
$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;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param Links $obj
*/
public function testGetters($obj)
{
$link2 = new Links();
$link2->fromJson($this->links->toJSON());
$this->assertEquals($this->links, $link2);
$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());
}
}
/**
* @depends testSerializationDeserialization
* @param Links $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param Links $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,198 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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");
}
/**
* @depends testSerializationDeserialization
* @param MerchantPreferences $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getSetup_fee(), CurrencyTest::getObject());
$this->assertEquals($obj->getCancel_url(), "http://www.google.com");
$this->assertEquals($obj->getReturn_url(), "http://www.google.com");
$this->assertEquals($obj->getNotify_url(), "http://www.google.com");
$this->assertEquals($obj->getMax_fail_attempts(), "TestSample");
$this->assertEquals($obj->getAuto_bill_amount(), "TestSample");
$this->assertEquals($obj->getInitial_fail_amount_action(), "TestSample");
$this->assertEquals($obj->getAccepted_payment_type(), "TestSample");
$this->assertEquals($obj->getChar_set(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param MerchantPreferences $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Setup_fee
$obj->setSetupFee(null);
$this->assertNull($obj->getSetup_fee());
$this->assertNull($obj->getSetupFee());
$this->assertSame($obj->getSetupFee(), $obj->getSetup_fee());
$obj->setSetup_fee(CurrencyTest::getObject());
$this->assertEquals($obj->getSetup_fee(), CurrencyTest::getObject());
// Check for Max_fail_attempts
$obj->setMaxFailAttempts(null);
$this->assertNull($obj->getMax_fail_attempts());
$this->assertNull($obj->getMaxFailAttempts());
$this->assertSame($obj->getMaxFailAttempts(), $obj->getMax_fail_attempts());
$obj->setMax_fail_attempts("TestSample");
$this->assertEquals($obj->getMax_fail_attempts(), "TestSample");
// Check for Auto_bill_amount
$obj->setAutoBillAmount(null);
$this->assertNull($obj->getAuto_bill_amount());
$this->assertNull($obj->getAutoBillAmount());
$this->assertSame($obj->getAutoBillAmount(), $obj->getAuto_bill_amount());
$obj->setAuto_bill_amount("TestSample");
$this->assertEquals($obj->getAuto_bill_amount(), "TestSample");
// Check for Initial_fail_amount_action
$obj->setInitialFailAmountAction(null);
$this->assertNull($obj->getInitial_fail_amount_action());
$this->assertNull($obj->getInitialFailAmountAction());
$this->assertSame($obj->getInitialFailAmountAction(), $obj->getInitial_fail_amount_action());
$obj->setInitial_fail_amount_action("TestSample");
$this->assertEquals($obj->getInitial_fail_amount_action(), "TestSample");
// Check for Accepted_payment_type
$obj->setAcceptedPaymentType(null);
$this->assertNull($obj->getAccepted_payment_type());
$this->assertNull($obj->getAcceptedPaymentType());
$this->assertSame($obj->getAcceptedPaymentType(), $obj->getAccepted_payment_type());
$obj->setAccepted_payment_type("TestSample");
$this->assertEquals($obj->getAccepted_payment_type(), "TestSample");
// Check for Char_set
$obj->setCharSet(null);
$this->assertNull($obj->getChar_set());
$this->assertNull($obj->getCharSet());
$this->assertSame($obj->getCharSet(), $obj->getChar_set());
$obj->setChar_set("TestSample");
$this->assertEquals($obj->getChar_set(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @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->setCancel_url(null);
$this->assertNull($obj->getCancel_url());
}
public function testUrlValidationForReturnUrlDeprecated()
{
$obj = new MerchantPreferences();
$obj->setReturn_url(null);
$this->assertNull($obj->getReturn_url());
}
public function testUrlValidationForNotifyUrlDeprecated()
{
$obj = new MerchantPreferences();
$obj->setNotify_url(null);
$this->assertNull($obj->getNotify_url());
}
}

View File

@@ -0,0 +1,89 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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());
}
/**
* @depends testSerializationDeserialization
* @param OverrideChargeModel $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCharge_id(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param OverrideChargeModel $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Charge_id
$obj->setChargeId(null);
$this->assertNull($obj->getCharge_id());
$this->assertNull($obj->getChargeId());
$this->assertSame($obj->getChargeId(), $obj->getCharge_id());
$obj->setCharge_id("TestSample");
$this->assertEquals($obj->getCharge_id(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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());
}
/**
* @depends testSerializationDeserialization
* @param PatchRequest $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param PatchRequest $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -18,7 +18,7 @@ class PatchTest extends \PHPUnit_Framework_TestCase
*/
public static function getJson()
{
return json_encode(json_decode('{"op":"TestSample","path":"TestSample","value":"TestSampleObject","from":"TestSample"}'));
return '{"op":"TestSample","path":"TestSample","value":"TestSampleObject","from":"TestSample"}';
}
/**

View File

@@ -1,55 +1,201 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\PayerInfo;
use PayPal\Test\Constants;
/**
* Class PayerInfo
*
* @package PayPal\Test\Api
*/
class PayerInfoTest extends \PHPUnit_Framework_TestCase
{
private $payerInfo;
public static $email = "test@paypal.com";
public static $firstName = "first";
public static $lastName = "last";
public static $phone = "408-1234-5687";
public static $payerId = "PAYER-1234";
public static function createPayerInfo()
/**
* Gets Json String of Object PayerInfo
* @return string
*/
public static function getJson()
{
$payerInfo = new PayerInfo();
$payerInfo->setEmail(self::$email);
$payerInfo->setFirstName(self::$firstName);
$payerInfo->setLastName(self::$lastName);
$payerInfo->setPhone(self::$phone);
$payerInfo->setPayerId(self::$payerId);
$payerInfo->setShippingAddress(ShippingAddressTest::createAddress());
return $payerInfo;
return '{"email":"TestSample","external_remember_me_id":"TestSample","buyer_account_number":"TestSample","first_name":"TestSample","last_name":"TestSample","payer_id":"TestSample","phone":"TestSample","phone_type":"TestSample","birth_date":"TestSample","tax_id":"TestSample","tax_id_type":"TestSample","billing_address":' .AddressTest::getJson() . ',"shipping_address":' .ShippingAddressTest::getJson() . '}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return PayerInfo
*/
public static function getObject()
{
$this->payerInfo = self::createPayerInfo();
return new PayerInfo(self::getJson());
}
public function testGetterSetter()
/**
* Tests for Serialization and Deserialization Issues
* @return PayerInfo
*/
public function testSerializationDeserialization()
{
$this->assertEquals(self::$email, $this->payerInfo->getEmail());
$this->assertEquals(self::$firstName, $this->payerInfo->getFirstName());
$this->assertEquals(self::$lastName, $this->payerInfo->getLastName());
$this->assertEquals(self::$phone, $this->payerInfo->getPhone());
$this->assertEquals(self::$payerId, $this->payerInfo->getPayerId());
$this->assertEquals(ShippingAddressTest::$line1, $this->payerInfo->getShippingAddress()->getLine1());
$obj = new PayerInfo(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getEmail());
$this->assertNotNull($obj->getExternalRememberMeId());
$this->assertNotNull($obj->getBuyerAccountNumber());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$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->getBillingAddress());
$this->assertNotNull($obj->getShippingAddress());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param PayerInfo $obj
*/
public function testGetters($obj)
{
$p1 = $this->payerInfo;
$p2 = new PayerInfo();
$p2->fromJson($p1->toJson());
$this->assertEquals($p1, $p2);
$this->assertEquals($obj->getEmail(), "TestSample");
$this->assertEquals($obj->getExternalRememberMeId(), "TestSample");
$this->assertEquals($obj->getBuyerAccountNumber(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "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->getBillingAddress(), AddressTest::getObject());
$this->assertEquals($obj->getShippingAddress(), ShippingAddressTest::getObject());
}
}
/**
* @depends testSerializationDeserialization
* @param PayerInfo $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getExternal_remember_me_id(), "TestSample");
$this->assertEquals($obj->getBuyer_account_number(), "TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
$this->assertEquals($obj->getPhone_type(), "TestSample");
$this->assertEquals($obj->getBirth_date(), "TestSample");
$this->assertEquals($obj->getTax_id(), "TestSample");
$this->assertEquals($obj->getTax_id_type(), "TestSample");
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
$this->assertEquals($obj->getShipping_address(), ShippingAddressTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param PayerInfo $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for External_remember_me_id
$obj->setExternalRememberMeId(null);
$this->assertNull($obj->getExternal_remember_me_id());
$this->assertNull($obj->getExternalRememberMeId());
$this->assertSame($obj->getExternalRememberMeId(), $obj->getExternal_remember_me_id());
$obj->setExternal_remember_me_id("TestSample");
$this->assertEquals($obj->getExternal_remember_me_id(), "TestSample");
// Check for Buyer_account_number
$obj->setBuyerAccountNumber(null);
$this->assertNull($obj->getBuyer_account_number());
$this->assertNull($obj->getBuyerAccountNumber());
$this->assertSame($obj->getBuyerAccountNumber(), $obj->getBuyer_account_number());
$obj->setBuyer_account_number("TestSample");
$this->assertEquals($obj->getBuyer_account_number(), "TestSample");
// Check for First_name
$obj->setFirstName(null);
$this->assertNull($obj->getFirst_name());
$this->assertNull($obj->getFirstName());
$this->assertSame($obj->getFirstName(), $obj->getFirst_name());
$obj->setFirst_name("TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
// Check for Last_name
$obj->setLastName(null);
$this->assertNull($obj->getLast_name());
$this->assertNull($obj->getLastName());
$this->assertSame($obj->getLastName(), $obj->getLast_name());
$obj->setLast_name("TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
// Check for Payer_id
$obj->setPayerId(null);
$this->assertNull($obj->getPayer_id());
$this->assertNull($obj->getPayerId());
$this->assertSame($obj->getPayerId(), $obj->getPayer_id());
$obj->setPayer_id("TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
// Check for Phone_type
$obj->setPhoneType(null);
$this->assertNull($obj->getPhone_type());
$this->assertNull($obj->getPhoneType());
$this->assertSame($obj->getPhoneType(), $obj->getPhone_type());
$obj->setPhone_type("TestSample");
$this->assertEquals($obj->getPhone_type(), "TestSample");
// Check for Birth_date
$obj->setBirthDate(null);
$this->assertNull($obj->getBirth_date());
$this->assertNull($obj->getBirthDate());
$this->assertSame($obj->getBirthDate(), $obj->getBirth_date());
$obj->setBirth_date("TestSample");
$this->assertEquals($obj->getBirth_date(), "TestSample");
// Check for Tax_id
$obj->setTaxId(null);
$this->assertNull($obj->getTax_id());
$this->assertNull($obj->getTaxId());
$this->assertSame($obj->getTaxId(), $obj->getTax_id());
$obj->setTax_id("TestSample");
$this->assertEquals($obj->getTax_id(), "TestSample");
// Check for Tax_id_type
$obj->setTaxIdType(null);
$this->assertNull($obj->getTax_id_type());
$this->assertNull($obj->getTaxIdType());
$this->assertSame($obj->getTaxIdType(), $obj->getTax_id_type());
$obj->setTax_id_type("TestSample");
$this->assertEquals($obj->getTax_id_type(), "TestSample");
// Check for Billing_address
$obj->setBillingAddress(null);
$this->assertNull($obj->getBilling_address());
$this->assertNull($obj->getBillingAddress());
$this->assertSame($obj->getBillingAddress(), $obj->getBilling_address());
$obj->setBilling_address(AddressTest::getObject());
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
// Check for Shipping_address
$obj->setShippingAddress(null);
$this->assertNull($obj->getShipping_address());
$this->assertNull($obj->getShippingAddress());
$this->assertSame($obj->getShippingAddress(), $obj->getShipping_address());
$obj->setShipping_address(ShippingAddressTest::getObject());
$this->assertEquals($obj->getShipping_address(), ShippingAddressTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -2,49 +2,121 @@
namespace PayPal\Test\Api;
use PayPal\Api\FundingInstrument;
use PayPal\Common\PPModel;
use PayPal\Api\Payer;
use PayPal\Test\Constants;
/**
* Class Payer
*
* @package PayPal\Test\Api
*/
class PayerTest extends \PHPUnit_Framework_TestCase
{
private $payer;
private static $paymentMethod = "credit_card";
public static function createPayer()
/**
* Gets Json String of Object Payer
* @return string
*/
public static function getJson()
{
$payer = new Payer();
$payer->setPaymentMethod(self::$paymentMethod);
$payer->setPayerInfo(PayerInfoTest::createPayerInfo());
$payer->setFundingInstruments(array(FundingInstrumentTest::createFundingInstrument()));
return $payer;
return '{"payment_method":"TestSample","status":"TestSample","funding_instruments":' .FundingInstrumentTest::getJson() . ',"funding_option_id":"TestSample","payer_info":' .PayerInfoTest::getJson() . '}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return Payer
*/
public static function getObject()
{
$this->payer = self::createPayer();
return new Payer(self::getJson());
}
public function testGetterSetter()
{
$this->assertEquals(self::$paymentMethod, $this->payer->getPaymentMethod());
$this->assertEquals(PayerInfoTest::$email, $this->payer->getPayerInfo()->getEmail());
$fi = $this->payer->getFundingInstruments();
$this->assertEquals(CreditCardTokenTest::$creditCardId, $fi[0]->getCreditCardToken()->getCreditCardId());
/**
* 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->getFundingInstruments());
$this->assertNotNull($obj->getFundingOptionId());
$this->assertNotNull($obj->getPayerInfo());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param Payer $obj
*/
public function testGetters($obj)
{
$p1 = $this->payer;
$p2 = new Payer();
$p2->fromJson($p1->toJson());
$this->assertEquals($p1, $p2);
$this->assertEquals($obj->getPaymentMethod(), "TestSample");
$this->assertEquals($obj->getStatus(), "TestSample");
$this->assertEquals($obj->getFundingInstruments(), FundingInstrumentTest::getObject());
$this->assertEquals($obj->getFundingOptionId(), "TestSample");
$this->assertEquals($obj->getPayerInfo(), PayerInfoTest::getObject());
}
}
/**
* @depends testSerializationDeserialization
* @param Payer $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getPayment_method(), "TestSample");
$this->assertEquals($obj->getFunding_instruments(), FundingInstrumentTest::getObject());
$this->assertEquals($obj->getFunding_option_id(), "TestSample");
$this->assertEquals($obj->getPayer_info(), PayerInfoTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param Payer $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Payment_method
$obj->setPaymentMethod(null);
$this->assertNull($obj->getPayment_method());
$this->assertNull($obj->getPaymentMethod());
$this->assertSame($obj->getPaymentMethod(), $obj->getPayment_method());
$obj->setPayment_method("TestSample");
$this->assertEquals($obj->getPayment_method(), "TestSample");
// Check for Funding_instruments
$obj->setFundingInstruments(null);
$this->assertNull($obj->getFunding_instruments());
$this->assertNull($obj->getFundingInstruments());
$this->assertSame($obj->getFundingInstruments(), $obj->getFunding_instruments());
$obj->setFunding_instruments(FundingInstrumentTest::getObject());
$this->assertEquals($obj->getFunding_instruments(), FundingInstrumentTest::getObject());
// Check for Funding_option_id
$obj->setFundingOptionId(null);
$this->assertNull($obj->getFunding_option_id());
$this->assertNull($obj->getFundingOptionId());
$this->assertSame($obj->getFundingOptionId(), $obj->getFunding_option_id());
$obj->setFunding_option_id("TestSample");
$this->assertEquals($obj->getFunding_option_id(), "TestSample");
// Check for Payer_info
$obj->setPayerInfo(null);
$this->assertNull($obj->getPayer_info());
$this->assertNull($obj->getPayerInfo());
$this->assertSame($obj->getPayerInfo(), $obj->getPayer_info());
$obj->setPayer_info(PayerInfoTest::getObject());
$this->assertEquals($obj->getPayer_info(), PayerInfoTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,187 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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":123,"start_year":123,"cvv2":123,"first_name":"TestSample","last_name":"TestSample","billing_address":' .AddressTest::getJson() . ',"external_customer_id":"TestSample","status":"TestSample","valid_until":"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->getBillingAddress());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getStatus());
$this->assertNotNull($obj->getValidUntil());
$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(), 123);
$this->assertEquals($obj->getStartYear(), 123);
$this->assertEquals($obj->getCvv2(), 123);
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "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->getLinks(), LinksTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param PaymentCard $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getExpire_month(), 123);
$this->assertEquals($obj->getExpire_year(), 123);
$this->assertEquals($obj->getStart_month(), 123);
$this->assertEquals($obj->getStart_year(), 123);
$this->assertEquals($obj->getFirst_name(), "TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param PaymentCard $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Expire_month
$obj->setExpireMonth(null);
$this->assertNull($obj->getExpire_month());
$this->assertNull($obj->getExpireMonth());
$this->assertSame($obj->getExpireMonth(), $obj->getExpire_month());
$obj->setExpire_month(123);
$this->assertEquals($obj->getExpire_month(), 123);
// Check for Expire_year
$obj->setExpireYear(null);
$this->assertNull($obj->getExpire_year());
$this->assertNull($obj->getExpireYear());
$this->assertSame($obj->getExpireYear(), $obj->getExpire_year());
$obj->setExpire_year(123);
$this->assertEquals($obj->getExpire_year(), 123);
// Check for Start_month
$obj->setStartMonth(null);
$this->assertNull($obj->getStart_month());
$this->assertNull($obj->getStartMonth());
$this->assertSame($obj->getStartMonth(), $obj->getStart_month());
$obj->setStart_month(123);
$this->assertEquals($obj->getStart_month(), 123);
// Check for Start_year
$obj->setStartYear(null);
$this->assertNull($obj->getStart_year());
$this->assertNull($obj->getStartYear());
$this->assertSame($obj->getStartYear(), $obj->getStart_year());
$obj->setStart_year(123);
$this->assertEquals($obj->getStart_year(), 123);
// Check for First_name
$obj->setFirstName(null);
$this->assertNull($obj->getFirst_name());
$this->assertNull($obj->getFirstName());
$this->assertSame($obj->getFirstName(), $obj->getFirst_name());
$obj->setFirst_name("TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
// Check for Last_name
$obj->setLastName(null);
$this->assertNull($obj->getLast_name());
$this->assertNull($obj->getLastName());
$this->assertSame($obj->getLastName(), $obj->getLast_name());
$obj->setLast_name("TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
// Check for Billing_address
$obj->setBillingAddress(null);
$this->assertNull($obj->getBilling_address());
$this->assertNull($obj->getBillingAddress());
$this->assertSame($obj->getBillingAddress(), $obj->getBilling_address());
$obj->setBilling_address(AddressTest::getObject());
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
// Check for External_customer_id
$obj->setExternalCustomerId(null);
$this->assertNull($obj->getExternal_customer_id());
$this->assertNull($obj->getExternalCustomerId());
$this->assertSame($obj->getExternalCustomerId(), $obj->getExternal_customer_id());
$obj->setExternal_customer_id("TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
// Check for Valid_until
$obj->setValidUntil(null);
$this->assertNull($obj->getValid_until());
$this->assertNull($obj->getValidUntil());
$this->assertSame($obj->getValidUntil(), $obj->getValid_until());
$obj->setValid_until("TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,124 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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);
}
/**
* @depends testSerializationDeserialization
* @param PaymentCardToken $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getPayment_card_id(), "TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
$this->assertEquals($obj->getExpire_month(), 123);
$this->assertEquals($obj->getExpire_year(), 123);
}
/**
* @depends testSerializationDeserialization
* @param PaymentCardToken $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Payment_card_id
$obj->setPaymentCardId(null);
$this->assertNull($obj->getPayment_card_id());
$this->assertNull($obj->getPaymentCardId());
$this->assertSame($obj->getPaymentCardId(), $obj->getPayment_card_id());
$obj->setPayment_card_id("TestSample");
$this->assertEquals($obj->getPayment_card_id(), "TestSample");
// Check for External_customer_id
$obj->setExternalCustomerId(null);
$this->assertNull($obj->getExternal_customer_id());
$this->assertNull($obj->getExternalCustomerId());
$this->assertSame($obj->getExternalCustomerId(), $obj->getExternal_customer_id());
$obj->setExternal_customer_id("TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
// Check for Expire_month
$obj->setExpireMonth(null);
$this->assertNull($obj->getExpire_month());
$this->assertNull($obj->getExpireMonth());
$this->assertSame($obj->getExpireMonth(), $obj->getExpire_month());
$obj->setExpire_month(123);
$this->assertEquals($obj->getExpire_month(), 123);
// Check for Expire_year
$obj->setExpireYear(null);
$this->assertNull($obj->getExpire_year());
$this->assertNull($obj->getExpireYear());
$this->assertSame($obj->getExpireYear(), $obj->getExpire_year());
$obj->setExpire_year(123);
$this->assertEquals($obj->getExpire_year(), 123);
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,110 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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());
}
/**
* @depends testSerializationDeserialization
* @param PaymentDefinition $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getFrequency_interval(), "TestSample");
$this->assertEquals($obj->getCharge_models(), ChargeModelTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param PaymentDefinition $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Frequency_interval
$obj->setFrequencyInterval(null);
$this->assertNull($obj->getFrequency_interval());
$this->assertNull($obj->getFrequencyInterval());
$this->assertSame($obj->getFrequencyInterval(), $obj->getFrequency_interval());
$obj->setFrequency_interval("TestSample");
$this->assertEquals($obj->getFrequency_interval(), "TestSample");
// Check for Charge_models
$obj->setChargeModels(null);
$this->assertNull($obj->getCharge_models());
$this->assertNull($obj->getChargeModels());
$this->assertSame($obj->getChargeModels(), $obj->getCharge_models());
$obj->setCharge_models(ChargeModelTest::getObject());
$this->assertEquals($obj->getCharge_models(), ChargeModelTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -26,7 +26,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
$payment = new Payment();
$payment->setIntent("sale");
$payment->setRedirectUrls($redirectUrls);
$payment->setPayer(PayerTest::createPayer());
$payment->setPayer(PayerTest::getObject());
$payment->setTransactions(array(TransactionTest::createTransaction()));
return $payment;
@@ -35,7 +35,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
public static function createNewPayment()
{
$funding = FundingInstrumentTest::createFundingInstrument();
$funding = FundingInstrumentTest::getObject();
$funding->credit_card_token = null;
$payer = new Payer();
@@ -72,24 +72,6 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($p2, $this->payments['full']);
}
/**
* @group integration
*/
public function testOperations()
{
$p1 = $this->payments['new'];
$p1->create();
$this->assertNotNull($p1->getId());
$p2 = Payment::get($p1->getId());
$this->assertNotNull($p2);
$paymentHistory = Payment::all(array('count' => '10'));
$this->assertNotNull($paymentHistory);
}
/**
* @group integration
*

View File

@@ -0,0 +1,102 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
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());
}
/**
* @depends testSerializationDeserialization
* @param PlanList $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getTotal_items(), "TestSample");
$this->assertEquals($obj->getTotal_pages(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param PlanList $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Total_items
$obj->setTotalItems(null);
$this->assertNull($obj->getTotal_items());
$this->assertNull($obj->getTotalItems());
$this->assertSame($obj->getTotalItems(), $obj->getTotal_items());
$obj->setTotal_items("TestSample");
$this->assertEquals($obj->getTotal_items(), "TestSample");
// Check for Total_pages
$obj->setTotalPages(null);
$this->assertNull($obj->getTotal_pages());
$this->assertNull($obj->getTotalPages());
$this->assertSame($obj->getTotalPages(), $obj->getTotal_pages());
$obj->setTotal_pages("TestSample");
$this->assertEquals($obj->getTotal_pages(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,227 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\ResourceModel;
use PayPal\Validation\ArgumentValidator;
use PayPal\Api\PlanList;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PPRestCall;
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());
}
/**
* @depends testSerializationDeserialization
* @param Plan $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCreate_time(), "TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
$this->assertEquals($obj->getPayment_definitions(), PaymentDefinitionTest::getObject());
$this->assertEquals($obj->getMerchant_preferences(), MerchantPreferencesTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param Plan $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Create_time
$obj->setCreateTime(null);
$this->assertNull($obj->getCreate_time());
$this->assertNull($obj->getCreateTime());
$this->assertSame($obj->getCreateTime(), $obj->getCreate_time());
$obj->setCreate_time("TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
// Check for Update_time
$obj->setUpdateTime(null);
$this->assertNull($obj->getUpdate_time());
$this->assertNull($obj->getUpdateTime());
$this->assertSame($obj->getUpdateTime(), $obj->getUpdate_time());
$obj->setUpdate_time("TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
// Check for Payment_definitions
$obj->setPaymentDefinitions(null);
$this->assertNull($obj->getPayment_definitions());
$this->assertNull($obj->getPaymentDefinitions());
$this->assertSame($obj->getPaymentDefinitions(), $obj->getPayment_definitions());
$obj->setPayment_definitions(PaymentDefinitionTest::getObject());
$this->assertEquals($obj->getPayment_definitions(), PaymentDefinitionTest::getObject());
// Check for Merchant_preferences
$obj->setMerchantPreferences(null);
$this->assertNull($obj->getMerchant_preferences());
$this->assertNull($obj->getMerchantPreferences());
$this->assertSame($obj->getMerchantPreferences(), $obj->getMerchant_preferences());
$obj->setMerchant_preferences(MerchantPreferencesTest::getObject());
$this->assertEquals($obj->getMerchant_preferences(), MerchantPreferencesTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @dataProvider mockProvider
* @param Plan $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PlanTest::getJson()
));
$result = $obj->get("planId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Plan $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Plan $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->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 Plan $obj
*/
public function testList($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PlanListTest::getJson()
));
$params = ParamsTest::getObject();
$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)
);
}
}

View File

@@ -21,7 +21,7 @@ class RefundTest extends \PHPUnit_Framework_TestCase
$refund->setAmount(AmountTest::createAmount());
$refund->setCaptureId(self::$captureId);
$refund->setId(self::$id);
$refund->setLinks(array(LinksTest::createLinks()));
$refund->setLinks(array(LinksTest::getObject()));
$refund->setParentPayment(self::$parentPayment);
return $refund;
@@ -40,7 +40,6 @@ class RefundTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(self::$parentPayment, $this->refund->getParentPayment());
$this->assertEquals(AmountTest::$currency, $this->refund->getAmount()->getCurrency());
$links = $this->refund->getLinks();
$this->assertEquals(LinksTest::$href, $links[0]->getHref());
}
public function testSerializeDeserialize()
@@ -57,4 +56,4 @@ class RefundTest extends \PHPUnit_Framework_TestCase
{
}
}
}

View File

@@ -55,33 +55,4 @@ class SaleTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($s1, $s2);
}
/**
* @group integration
*/
public function testOperations()
{
try {
$payment = PaymentTest::createNewPayment();
$payment->create();
$transactions = $payment->getTransactions();
$resources = $transactions[0]->getRelatedResources();
$saleId = $resources[0]->getSale()->getId();
$sale = Sale::get($saleId);
$this->assertNotNull($sale);
$refund = new Refund();
$refund->setAmount(AmountTest::createAmount());
$sale->refund($refund);
$this->setExpectedException('\InvalidArgumentException');
$sale->refund(NULL);
} catch (PPConnectionException $ex) {
$this->markTestSkipped(
'Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()
);
}
}
}
}

View File

@@ -1,61 +1,100 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\ShippingAddress;
use PayPal\Test\Constants;
/**
* Class ShippingAddress
*
* @package PayPal\Test\Api
*/
class ShippingAddressTest extends \PHPUnit_Framework_TestCase
{
private $address;
public static $line1 = "3909 Witmer Road";
public static $line2 = "Niagara Falls";
public static $city = "Niagara Falls";
public static $state = "NY";
public static $postalCode = "14305";
public static $countryCode = "US";
public static $phone = "716-298-1822";
public static $recipientName = "TestUser";
public static function createAddress()
/**
* Gets Json String of Object ShippingAddress
* @return string
*/
public static function getJson()
{
$addr = new ShippingAddress();
$addr->setLine1(self::$line1);
$addr->setLine2(self::$line2);
$addr->setCity(self::$city);
$addr->setState(self::$state);
$addr->setPostalCode(self::$postalCode);
$addr->setCountryCode(self::$countryCode);
$addr->setPhone(self::$phone);
$addr->setRecipientName(self::$recipientName);
return $addr;
return '{"id":"TestSample","recipient_name":"TestSample","default_address":true}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return ShippingAddress
*/
public static function getObject()
{
$this->address = self::createAddress();
return new ShippingAddress(self::getJson());
}
public function testGetterSetter()
/**
* Tests for Serialization and Deserialization Issues
* @return ShippingAddress
*/
public function testSerializationDeserialization()
{
$this->assertEquals(self::$line1, $this->address->getLine1());
$this->assertEquals(self::$line2, $this->address->getLine2());
$this->assertEquals(self::$city, $this->address->getCity());
$this->assertEquals(self::$state, $this->address->getState());
$this->assertEquals(self::$postalCode, $this->address->getPostalCode());
$this->assertEquals(self::$countryCode, $this->address->getCountryCode());
$this->assertEquals(self::$phone, $this->address->getPhone());
$this->assertEquals(self::$recipientName, $this->address->getRecipientName());
$obj = new ShippingAddress(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getRecipientName());
$this->assertNotNull($obj->getDefaultAddress());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param ShippingAddress $obj
*/
public function testGetters($obj)
{
$a1 = $this->address;
$a2 = new ShippingAddress();
$a2->fromJson($a1->toJson());
$this->assertEquals($a1, $a2);
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getRecipientName(), "TestSample");
$this->assertEquals($obj->getDefaultAddress(), true);
}
}
/**
* @depends testSerializationDeserialization
* @param ShippingAddress $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getRecipient_name(), "TestSample");
$this->assertEquals($obj->getDefault_address(), true);
}
/**
* @depends testSerializationDeserialization
* @param ShippingAddress $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Recipient_name
$obj->setRecipientName(null);
$this->assertNull($obj->getRecipient_name());
$this->assertNull($obj->getRecipientName());
$this->assertSame($obj->getRecipientName(), $obj->getRecipient_name());
$obj->setRecipient_name("TestSample");
$this->assertEquals($obj->getRecipient_name(), "TestSample");
// Check for Default_address
$obj->setDefaultAddress(null);
$this->assertNull($obj->getDefault_address());
$this->assertNull($obj->getDefaultAddress());
$this->assertSame($obj->getDefaultAddress(), $obj->getDefault_address());
$obj->setDefault_address(true);
$this->assertEquals($obj->getDefault_address(), true);
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,115 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Terms;
/**
* Class Terms
*
* @package PayPal\Test\Api
*/
class TermsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Terms
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","type":"TestSample","max_billing_amount":' .CurrencyTest::getJson() . ',"occurrences":"TestSample","amount_range":' .CurrencyTest::getJson() . ',"buyer_editable":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Terms
*/
public static function getObject()
{
return new Terms(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Terms
*/
public function testSerializationDeserialization()
{
$obj = new Terms(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getMaxBillingAmount());
$this->assertNotNull($obj->getOccurrences());
$this->assertNotNull($obj->getAmountRange());
$this->assertNotNull($obj->getBuyerEditable());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Terms $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getMaxBillingAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getOccurrences(), "TestSample");
$this->assertEquals($obj->getAmountRange(), CurrencyTest::getObject());
$this->assertEquals($obj->getBuyerEditable(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Terms $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getMax_billing_amount(), CurrencyTest::getObject());
$this->assertEquals($obj->getAmount_range(), CurrencyTest::getObject());
$this->assertEquals($obj->getBuyer_editable(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Terms $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Max_billing_amount
$obj->setMaxBillingAmount(null);
$this->assertNull($obj->getMax_billing_amount());
$this->assertNull($obj->getMaxBillingAmount());
$this->assertSame($obj->getMaxBillingAmount(), $obj->getMax_billing_amount());
$obj->setMax_billing_amount(CurrencyTest::getObject());
$this->assertEquals($obj->getMax_billing_amount(), CurrencyTest::getObject());
// Check for Amount_range
$obj->setAmountRange(null);
$this->assertNull($obj->getAmount_range());
$this->assertNull($obj->getAmountRange());
$this->assertSame($obj->getAmountRange(), $obj->getAmount_range());
$obj->setAmount_range(CurrencyTest::getObject());
$this->assertEquals($obj->getAmount_range(), CurrencyTest::getObject());
// Check for Buyer_editable
$obj->setBuyerEditable(null);
$this->assertNull($obj->getBuyer_editable());
$this->assertNull($obj->getBuyerEditable());
$this->assertSame($obj->getBuyerEditable(), $obj->getBuyer_editable());
$obj->setBuyer_editable("TestSample");
$this->assertEquals($obj->getBuyer_editable(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}