Unit Tests and Functional Tests for Invoicing

- Updated Unit Tests for PPModels used by Invoicing
- Updated Functional Tests
- Updated Samples for quick changes.
This commit is contained in:
japatel
2014-11-19 15:21:18 -06:00
parent ef4797a94c
commit 026802443d
41 changed files with 3795 additions and 7 deletions

View File

@@ -0,0 +1,139 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\BillingInfo;
/**
* Class BillingInfo
*
* @package PayPal\Test\Api
*/
class BillingInfoTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object BillingInfo
* @return string
*/
public static function getJson()
{
return '{"email":"TestSample","first_name":"TestSample","last_name":"TestSample","business_name":"TestSample","address":' .AddressTest::getJson() . ',"language":"TestSample","additional_info":"TestSample","notification_channel":"TestSample","phone":' .PhoneTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return BillingInfo
*/
public static function getObject()
{
return new BillingInfo(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return BillingInfo
*/
public function testSerializationDeserialization()
{
$obj = new BillingInfo(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getEmail());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getBusinessName());
$this->assertNotNull($obj->getAddress());
$this->assertNotNull($obj->getLanguage());
$this->assertNotNull($obj->getAdditionalInfo());
$this->assertNotNull($obj->getNotificationChannel());
$this->assertNotNull($obj->getPhone());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param BillingInfo $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getEmail(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getBusinessName(), "TestSample");
$this->assertEquals($obj->getAddress(), AddressTest::getObject());
$this->assertEquals($obj->getLanguage(), "TestSample");
$this->assertEquals($obj->getAdditionalInfo(), "TestSample");
$this->assertEquals($obj->getNotificationChannel(), "TestSample");
$this->assertEquals($obj->getPhone(), PhoneTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param BillingInfo $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getFirst_name(), "TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
$this->assertEquals($obj->getBusiness_name(), "TestSample");
$this->assertEquals($obj->getAdditional_info(), "TestSample");
$this->assertEquals($obj->getNotification_channel(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param BillingInfo $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// 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 Business_name
$obj->setBusinessName(null);
$this->assertNull($obj->getBusiness_name());
$this->assertNull($obj->getBusinessName());
$this->assertSame($obj->getBusinessName(), $obj->getBusiness_name());
$obj->setBusiness_name("TestSample");
$this->assertEquals($obj->getBusiness_name(), "TestSample");
// Check for Additional_info
$obj->setAdditionalInfo(null);
$this->assertNull($obj->getAdditional_info());
$this->assertNull($obj->getAdditionalInfo());
$this->assertSame($obj->getAdditionalInfo(), $obj->getAdditional_info());
$obj->setAdditional_info("TestSample");
$this->assertEquals($obj->getAdditional_info(), "TestSample");
// Check for Notification_channel
$obj->setNotificationChannel(null);
$this->assertNull($obj->getNotification_channel());
$this->assertNull($obj->getNotificationChannel());
$this->assertSame($obj->getNotificationChannel(), $obj->getNotification_channel());
$obj->setNotification_channel("TestSample");
$this->assertEquals($obj->getNotification_channel(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,102 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\CancelNotification;
/**
* Class CancelNotification
*
* @package PayPal\Test\Api
*/
class CancelNotificationTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CancelNotification
* @return string
*/
public static function getJson()
{
return '{"subject":"TestSample","note":"TestSample","send_to_merchant":true,"send_to_payer":true}';
}
/**
* Gets Object Instance with Json data filled in
* @return CancelNotification
*/
public static function getObject()
{
return new CancelNotification(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return CancelNotification
*/
public function testSerializationDeserialization()
{
$obj = new CancelNotification(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getSubject());
$this->assertNotNull($obj->getNote());
$this->assertNotNull($obj->getSendToMerchant());
$this->assertNotNull($obj->getSendToPayer());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CancelNotification $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getSubject(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
$this->assertEquals($obj->getSendToMerchant(), true);
$this->assertEquals($obj->getSendToPayer(), true);
}
/**
* @depends testSerializationDeserialization
* @param CancelNotification $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getSend_to_merchant(), true);
$this->assertEquals($obj->getSend_to_payer(), true);
}
/**
* @depends testSerializationDeserialization
* @param CancelNotification $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Send_to_merchant
$obj->setSendToMerchant(null);
$this->assertNull($obj->getSend_to_merchant());
$this->assertNull($obj->getSendToMerchant());
$this->assertSame($obj->getSendToMerchant(), $obj->getSend_to_merchant());
$obj->setSend_to_merchant(true);
$this->assertEquals($obj->getSend_to_merchant(), true);
// Check for Send_to_payer
$obj->setSendToPayer(null);
$this->assertNull($obj->getSend_to_payer());
$this->assertNull($obj->getSendToPayer());
$this->assertSame($obj->getSendToPayer(), $obj->getSend_to_payer());
$obj->setSend_to_payer(true);
$this->assertEquals($obj->getSend_to_payer(), true);
//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\Common\FormatConverter;
use PayPal\Validation\NumericValidator;
use PayPal\Api\Cost;
/**
* Class Cost
*
* @package PayPal\Test\Api
*/
class CostTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Cost
* @return string
*/
public static function getJson()
{
return '{"percent":"12.34","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return Cost
*/
public static function getObject()
{
return new Cost(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Cost
*/
public function testSerializationDeserialization()
{
$obj = new Cost(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPercent());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Cost $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPercent(), "12.34");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param Cost $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param Cost $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -3,6 +3,8 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Common\FormatConverter;
use PayPal\Validation\NumericValidator;
use PayPal\Api\Currency;
/**

View File

@@ -0,0 +1,80 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\CustomAmount;
/**
* Class CustomAmount
*
* @package PayPal\Test\Api
*/
class CustomAmountTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CustomAmount
* @return string
*/
public static function getJson()
{
return '{"label":"TestSample","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return CustomAmount
*/
public static function getObject()
{
return new CustomAmount(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return CustomAmount
*/
public function testSerializationDeserialization()
{
$obj = new CustomAmount(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getLabel());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CustomAmount $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getLabel(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param CustomAmount $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param CustomAmount $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\ErrorDetails;
/**
* Class ErrorDetails
*
* @package PayPal\Test\Api
*/
class ErrorDetailsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object ErrorDetails
* @return string
*/
public static function getJson()
{
return '{"field":"TestSample","issue":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return ErrorDetails
*/
public static function getObject()
{
return new ErrorDetails(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return ErrorDetails
*/
public function testSerializationDeserialization()
{
$obj = new ErrorDetails(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getField());
$this->assertNotNull($obj->getIssue());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param ErrorDetails $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getField(), "TestSample");
$this->assertEquals($obj->getIssue(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param ErrorDetails $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param ErrorDetails $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Error;
/**
* Class Error
*
* @package PayPal\Test\Api
*/
class ErrorTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Error
* @return string
*/
public static function getJson()
{
return '{"name":"TestSample","debug_id":"TestSample","message":"TestSample","information_link":"TestSample","details":' .ErrorDetailsTest::getJson() . ',"links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return Error
*/
public static function getObject()
{
return new Error(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Error
*/
public function testSerializationDeserialization()
{
$obj = new Error(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getDebugId());
$this->assertNotNull($obj->getMessage());
$this->assertNotNull($obj->getInformationLink());
$this->assertNotNull($obj->getDetails());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Error $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getDebugId(), "TestSample");
$this->assertEquals($obj->getMessage(), "TestSample");
$this->assertEquals($obj->getInformationLink(), "TestSample");
$this->assertEquals($obj->getDetails(), ErrorDetailsTest::getObject());
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param Error $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getDebug_id(), "TestSample");
$this->assertEquals($obj->getInformation_link(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Error $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Debug_id
$obj->setDebugId(null);
$this->assertNull($obj->getDebug_id());
$this->assertNull($obj->getDebugId());
$this->assertSame($obj->getDebugId(), $obj->getDebug_id());
$obj->setDebug_id("TestSample");
$this->assertEquals($obj->getDebug_id(), "TestSample");
// Check for Information_link
$obj->setInformationLink(null);
$this->assertNull($obj->getInformation_link());
$this->assertNull($obj->getInformationLink());
$this->assertSame($obj->getInformationLink(), $obj->getInformation_link());
$obj->setInformation_link("TestSample");
$this->assertEquals($obj->getInformation_link(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Image;
/**
* Class Image
*
* @package PayPal\Test\Api
*/
class ImageTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Patch
* @return string
*/
public static function getJson()
{
return '{"image":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Image
*/
public static function getObject()
{
return new Image(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Image
*/
public function testSerializationDeserialization()
{
$obj = new Image(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getImage());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Image $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getImage(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Image $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param Image $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,99 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\InvoiceItem;
/**
* Class InvoiceItem
*
* @package PayPal\Test\Api
*/
class InvoiceItemTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object InvoiceItem
* @return string
*/
public static function getJson()
{
return '{"name":"TestSample","description":"TestSample","quantity":"12.34","unit_price":' .CurrencyTest::getJson() . ',"tax":' .TaxTest::getJson() . ',"date":"TestSample","discount":' .CostTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return InvoiceItem
*/
public static function getObject()
{
return new InvoiceItem(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return InvoiceItem
*/
public function testSerializationDeserialization()
{
$obj = new InvoiceItem(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getDescription());
$this->assertNotNull($obj->getQuantity());
$this->assertNotNull($obj->getUnitPrice());
$this->assertNotNull($obj->getTax());
$this->assertNotNull($obj->getDate());
$this->assertNotNull($obj->getDiscount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param InvoiceItem $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getDescription(), "TestSample");
$this->assertEquals($obj->getQuantity(), "12.34");
$this->assertEquals($obj->getUnitPrice(), CurrencyTest::getObject());
$this->assertEquals($obj->getTax(), TaxTest::getObject());
$this->assertEquals($obj->getDate(), "TestSample");
$this->assertEquals($obj->getDiscount(), CostTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param InvoiceItem $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getUnit_price(), CurrencyTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param InvoiceItem $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Unit_price
$obj->setUnitPrice(null);
$this->assertNull($obj->getUnit_price());
$this->assertNull($obj->getUnitPrice());
$this->assertSame($obj->getUnitPrice(), $obj->getUnit_price());
$obj->setUnit_price(CurrencyTest::getObject());
$this->assertEquals($obj->getUnit_price(), CurrencyTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,89 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\InvoiceSearchResponse;
/**
* Class InvoiceSearchResponse
*
* @package PayPal\Test\Api
*/
class InvoiceSearchResponseTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object InvoiceSearchResponse
* @return string
*/
public static function getJson()
{
return '{"total_count":123,"invoices":' .InvoiceTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return InvoiceSearchResponse
*/
public static function getObject()
{
return new InvoiceSearchResponse(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return InvoiceSearchResponse
*/
public function testSerializationDeserialization()
{
$obj = new InvoiceSearchResponse(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getTotalCount());
$this->assertNotNull($obj->getInvoices());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param InvoiceSearchResponse $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getTotalCount(), 123);
$this->assertEquals($obj->getInvoices(), InvoiceTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param InvoiceSearchResponse $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getTotal_count(), 123);
}
/**
* @depends testSerializationDeserialization
* @param InvoiceSearchResponse $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Total_count
$obj->setTotalCount(null);
$this->assertNull($obj->getTotal_count());
$this->assertNull($obj->getTotalCount());
$this->assertSame($obj->getTotalCount(), $obj->getTotal_count());
$obj->setTotal_count(123);
$this->assertEquals($obj->getTotal_count(), 123);
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,505 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\ResourceModel;
use PayPal\Validation\ArgumentValidator;
use PayPal\Api\InvoiceSearchResponse;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PPRestCall;
use PayPal\Api\Invoice;
/**
* Class Invoice
*
* @package PayPal\Test\Api
*/
class InvoiceTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Invoice
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","number":"TestSample","uri":"TestSample","status":"TestSample","merchant_info":' .MerchantInfoTest::getJson() . ',"billing_info":' .BillingInfoTest::getJson() . ',"shipping_info":' .ShippingInfoTest::getJson() . ',"items":' .InvoiceItemTest::getJson() . ',"invoice_date":"TestSample","payment_term":' .PaymentTermTest::getJson() . ',"discount":' .CostTest::getJson() . ',"shipping_cost":' .ShippingCostTest::getJson() . ',"custom":' .CustomAmountTest::getJson() . ',"tax_calculated_after_discount":true,"tax_inclusive":true,"terms":"TestSample","note":"TestSample","merchant_memo":"TestSample","logo_url":"http://www.google.com","total_amount":' .CurrencyTest::getJson() . ',"payment_details":' .PaymentDetailTest::getJson() . ',"refund_details":' .RefundDetailTest::getJson() . ',"metadata":' .MetadataTest::getJson() . ',"additional_data":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Invoice
*/
public static function getObject()
{
return new Invoice(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Invoice
*/
public function testSerializationDeserialization()
{
$obj = new Invoice(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getNumber());
$this->assertNotNull($obj->getUri());
$this->assertNotNull($obj->getStatus());
$this->assertNotNull($obj->getMerchantInfo());
$this->assertNotNull($obj->getBillingInfo());
$this->assertNotNull($obj->getShippingInfo());
$this->assertNotNull($obj->getItems());
$this->assertNotNull($obj->getInvoiceDate());
$this->assertNotNull($obj->getPaymentTerm());
$this->assertNotNull($obj->getDiscount());
$this->assertNotNull($obj->getShippingCost());
$this->assertNotNull($obj->getCustom());
$this->assertNotNull($obj->getTaxCalculatedAfterDiscount());
$this->assertNotNull($obj->getTaxInclusive());
$this->assertNotNull($obj->getTerms());
$this->assertNotNull($obj->getNote());
$this->assertNotNull($obj->getMerchantMemo());
$this->assertNotNull($obj->getLogoUrl());
$this->assertNotNull($obj->getTotalAmount());
$this->assertNotNull($obj->getPaymentDetails());
$this->assertNotNull($obj->getRefundDetails());
$this->assertNotNull($obj->getMetadata());
$this->assertNotNull($obj->getAdditionalData());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Invoice $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getNumber(), "TestSample");
$this->assertEquals($obj->getUri(), "TestSample");
$this->assertEquals($obj->getStatus(), "TestSample");
$this->assertEquals($obj->getMerchantInfo(), MerchantInfoTest::getObject());
$this->assertEquals($obj->getBillingInfo(), BillingInfoTest::getObject());
$this->assertEquals($obj->getShippingInfo(), ShippingInfoTest::getObject());
$this->assertEquals($obj->getItems(), InvoiceItemTest::getObject());
$this->assertEquals($obj->getInvoiceDate(), "TestSample");
$this->assertEquals($obj->getPaymentTerm(), PaymentTermTest::getObject());
$this->assertEquals($obj->getDiscount(), CostTest::getObject());
$this->assertEquals($obj->getShippingCost(), ShippingCostTest::getObject());
$this->assertEquals($obj->getCustom(), CustomAmountTest::getObject());
$this->assertEquals($obj->getTaxCalculatedAfterDiscount(), true);
$this->assertEquals($obj->getTaxInclusive(), true);
$this->assertEquals($obj->getTerms(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
$this->assertEquals($obj->getMerchantMemo(), "TestSample");
$this->assertEquals($obj->getLogoUrl(), "http://www.google.com");
$this->assertEquals($obj->getTotalAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getPaymentDetails(), PaymentDetailTest::getObject());
$this->assertEquals($obj->getRefundDetails(), RefundDetailTest::getObject());
$this->assertEquals($obj->getMetadata(), MetadataTest::getObject());
$this->assertEquals($obj->getAdditionalData(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Invoice $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getMerchant_info(), MerchantInfoTest::getObject());
$this->assertEquals($obj->getBilling_info(), BillingInfoTest::getObject());
$this->assertEquals($obj->getShipping_info(), ShippingInfoTest::getObject());
$this->assertEquals($obj->getInvoice_date(), "TestSample");
$this->assertEquals($obj->getPayment_term(), PaymentTermTest::getObject());
$this->assertEquals($obj->getShipping_cost(), ShippingCostTest::getObject());
$this->assertEquals($obj->getTax_calculated_after_discount(), true);
$this->assertEquals($obj->getTax_inclusive(), true);
$this->assertEquals($obj->getMerchant_memo(), "TestSample");
$this->assertEquals($obj->getLogo_url(), "http://www.google.com");
$this->assertEquals($obj->getTotal_amount(), CurrencyTest::getObject());
$this->assertEquals($obj->getPayment_details(), PaymentDetailTest::getObject());
$this->assertEquals($obj->getRefund_details(), RefundDetailTest::getObject());
$this->assertEquals($obj->getAdditional_data(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Invoice $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Merchant_info
$obj->setMerchantInfo(null);
$this->assertNull($obj->getMerchant_info());
$this->assertNull($obj->getMerchantInfo());
$this->assertSame($obj->getMerchantInfo(), $obj->getMerchant_info());
$obj->setMerchant_info(MerchantInfoTest::getObject());
$this->assertEquals($obj->getMerchant_info(), MerchantInfoTest::getObject());
// Check for Billing_info
$obj->setBillingInfo(null);
$this->assertNull($obj->getBilling_info());
$this->assertNull($obj->getBillingInfo());
$this->assertSame($obj->getBillingInfo(), $obj->getBilling_info());
$obj->setBilling_info(BillingInfoTest::getObject());
$this->assertEquals($obj->getBilling_info(), BillingInfoTest::getObject());
// Check for Shipping_info
$obj->setShippingInfo(null);
$this->assertNull($obj->getShipping_info());
$this->assertNull($obj->getShippingInfo());
$this->assertSame($obj->getShippingInfo(), $obj->getShipping_info());
$obj->setShipping_info(ShippingInfoTest::getObject());
$this->assertEquals($obj->getShipping_info(), ShippingInfoTest::getObject());
// Check for Invoice_date
$obj->setInvoiceDate(null);
$this->assertNull($obj->getInvoice_date());
$this->assertNull($obj->getInvoiceDate());
$this->assertSame($obj->getInvoiceDate(), $obj->getInvoice_date());
$obj->setInvoice_date("TestSample");
$this->assertEquals($obj->getInvoice_date(), "TestSample");
// Check for Payment_term
$obj->setPaymentTerm(null);
$this->assertNull($obj->getPayment_term());
$this->assertNull($obj->getPaymentTerm());
$this->assertSame($obj->getPaymentTerm(), $obj->getPayment_term());
$obj->setPayment_term(PaymentTermTest::getObject());
$this->assertEquals($obj->getPayment_term(), PaymentTermTest::getObject());
// Check for Shipping_cost
$obj->setShippingCost(null);
$this->assertNull($obj->getShipping_cost());
$this->assertNull($obj->getShippingCost());
$this->assertSame($obj->getShippingCost(), $obj->getShipping_cost());
$obj->setShipping_cost(ShippingCostTest::getObject());
$this->assertEquals($obj->getShipping_cost(), ShippingCostTest::getObject());
// Check for Tax_calculated_after_discount
$obj->setTaxCalculatedAfterDiscount(null);
$this->assertNull($obj->getTax_calculated_after_discount());
$this->assertNull($obj->getTaxCalculatedAfterDiscount());
$this->assertSame($obj->getTaxCalculatedAfterDiscount(), $obj->getTax_calculated_after_discount());
$obj->setTax_calculated_after_discount(true);
$this->assertEquals($obj->getTax_calculated_after_discount(), true);
// Check for Tax_inclusive
$obj->setTaxInclusive(null);
$this->assertNull($obj->getTax_inclusive());
$this->assertNull($obj->getTaxInclusive());
$this->assertSame($obj->getTaxInclusive(), $obj->getTax_inclusive());
$obj->setTax_inclusive(true);
$this->assertEquals($obj->getTax_inclusive(), true);
// Check for Merchant_memo
$obj->setMerchantMemo(null);
$this->assertNull($obj->getMerchant_memo());
$this->assertNull($obj->getMerchantMemo());
$this->assertSame($obj->getMerchantMemo(), $obj->getMerchant_memo());
$obj->setMerchant_memo("TestSample");
$this->assertEquals($obj->getMerchant_memo(), "TestSample");
// Check for Total_amount
$obj->setTotalAmount(null);
$this->assertNull($obj->getTotal_amount());
$this->assertNull($obj->getTotalAmount());
$this->assertSame($obj->getTotalAmount(), $obj->getTotal_amount());
$obj->setTotal_amount(CurrencyTest::getObject());
$this->assertEquals($obj->getTotal_amount(), CurrencyTest::getObject());
// Check for Payment_details
$obj->setPaymentDetails(null);
$this->assertNull($obj->getPayment_details());
$this->assertNull($obj->getPaymentDetails());
$this->assertSame($obj->getPaymentDetails(), $obj->getPayment_details());
$obj->setPayment_details(PaymentDetailTest::getObject());
$this->assertEquals($obj->getPayment_details(), PaymentDetailTest::getObject());
// Check for Refund_details
$obj->setRefundDetails(null);
$this->assertNull($obj->getRefund_details());
$this->assertNull($obj->getRefundDetails());
$this->assertSame($obj->getRefundDetails(), $obj->getRefund_details());
$obj->setRefund_details(RefundDetailTest::getObject());
$this->assertEquals($obj->getRefund_details(), RefundDetailTest::getObject());
// Check for Additional_data
$obj->setAdditionalData(null);
$this->assertNull($obj->getAdditional_data());
$this->assertNull($obj->getAdditionalData());
$this->assertSame($obj->getAdditionalData(), $obj->getAdditional_data());
$obj->setAdditional_data("TestSample");
$this->assertEquals($obj->getAdditional_data(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage LogoUrl is not a fully qualified URL
*/
public function testUrlValidationForLogoUrl()
{
$obj = new Invoice();
$obj->setLogoUrl(null);
}
public function testUrlValidationForLogoUrlDeprecated()
{
$obj = new Invoice();
$obj->setLogo_url(null);
$this->assertNull($obj->getLogo_url());
}
/**
* @dataProvider mockProvider
* @param Invoice $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 Invoice $obj
*/
public function testSearch($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
InvoiceSearchResponseTest::getJson()
));
$search = SearchTest::getObject();
$result = $obj->search($search, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testSend($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$result = $obj->send($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testRemind($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$notification = NotificationTest::getObject();
$result = $obj->remind($notification, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testCancel($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$cancelNotification = CancelNotificationTest::getObject();
$result = $obj->cancel($cancelNotification, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testRecordPayment($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$paymentDetail = PaymentDetailTest::getObject();
$result = $obj->recordPayment($paymentDetail, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testRecordRefund($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$refundDetail = RefundDetailTest::getObject();
$result = $obj->recordRefund($refundDetail, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
InvoiceTest::getJson()
));
$result = $obj->get("invoiceId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $obj
*/
public function testGetAll($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
InvoiceSearchResponseTest::getJson()
));
$result = $obj->getAll(array(), $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Invoice $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);
}
/**
* @dataProvider mockProvider
* @param Invoice $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 Invoice $obj
*/
public function testQrCode($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
ImageTest::getJson()
));
$result = $obj->qrCode("invoiceId", array(), $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,141 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\MerchantInfo;
/**
* Class MerchantInfo
*
* @package PayPal\Test\Api
*/
class MerchantInfoTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object MerchantInfo
* @return string
*/
public static function getJson()
{
return '{"email":"TestSample","first_name":"TestSample","last_name":"TestSample","address":' .AddressTest::getJson() . ',"business_name":"TestSample","phone":' .PhoneTest::getJson() . ',"fax":' .PhoneTest::getJson() . ',"website":"TestSample","tax_id":"TestSample","additional_info":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return MerchantInfo
*/
public static function getObject()
{
return new MerchantInfo(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return MerchantInfo
*/
public function testSerializationDeserialization()
{
$obj = new MerchantInfo(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getEmail());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getAddress());
$this->assertNotNull($obj->getBusinessName());
$this->assertNotNull($obj->getPhone());
$this->assertNotNull($obj->getFax());
$this->assertNotNull($obj->getWebsite());
$this->assertNotNull($obj->getTaxId());
$this->assertNotNull($obj->getAdditionalInfo());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param MerchantInfo $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getEmail(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getAddress(), AddressTest::getObject());
$this->assertEquals($obj->getBusinessName(), "TestSample");
$this->assertEquals($obj->getPhone(), PhoneTest::getObject());
$this->assertEquals($obj->getFax(), PhoneTest::getObject());
$this->assertEquals($obj->getWebsite(), "TestSample");
$this->assertEquals($obj->getTaxId(), "TestSample");
$this->assertEquals($obj->getAdditionalInfo(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param MerchantInfo $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getFirst_name(), "TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
$this->assertEquals($obj->getBusiness_name(), "TestSample");
$this->assertEquals($obj->getTax_id(), "TestSample");
$this->assertEquals($obj->getAdditional_info(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param MerchantInfo $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// 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 Business_name
$obj->setBusinessName(null);
$this->assertNull($obj->getBusiness_name());
$this->assertNull($obj->getBusinessName());
$this->assertSame($obj->getBusinessName(), $obj->getBusiness_name());
$obj->setBusiness_name("TestSample");
$this->assertEquals($obj->getBusiness_name(), "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 Additional_info
$obj->setAdditionalInfo(null);
$this->assertNull($obj->getAdditional_info());
$this->assertNull($obj->getAdditionalInfo());
$this->assertSame($obj->getAdditionalInfo(), $obj->getAdditional_info());
$obj->setAdditional_info("TestSample");
$this->assertEquals($obj->getAdditional_info(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,193 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Metadata;
/**
* Class Metadata
*
* @package PayPal\Test\Api
*/
class MetadataTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Metadata
* @return string
*/
public static function getJson()
{
return '{"created_date":"TestSample","created_by":"TestSample","cancelled_date":"TestSample","cancelled_by":"TestSample","last_updated_date":"TestSample","last_updated_by":"TestSample","first_sent_date":"TestSample","last_sent_date":"TestSample","last_sent_by":"TestSample","payer_view_url":"http://www.google.com"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Metadata
*/
public static function getObject()
{
return new Metadata(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Metadata
*/
public function testSerializationDeserialization()
{
$obj = new Metadata(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCreatedDate());
$this->assertNotNull($obj->getCreatedBy());
$this->assertNotNull($obj->getCancelledDate());
$this->assertNotNull($obj->getCancelledBy());
$this->assertNotNull($obj->getLastUpdatedDate());
$this->assertNotNull($obj->getLastUpdatedBy());
$this->assertNotNull($obj->getFirstSentDate());
$this->assertNotNull($obj->getLastSentDate());
$this->assertNotNull($obj->getLastSentBy());
$this->assertNotNull($obj->getPayerViewUrl());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Metadata $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCreatedDate(), "TestSample");
$this->assertEquals($obj->getCreatedBy(), "TestSample");
$this->assertEquals($obj->getCancelledDate(), "TestSample");
$this->assertEquals($obj->getCancelledBy(), "TestSample");
$this->assertEquals($obj->getLastUpdatedDate(), "TestSample");
$this->assertEquals($obj->getLastUpdatedBy(), "TestSample");
$this->assertEquals($obj->getFirstSentDate(), "TestSample");
$this->assertEquals($obj->getLastSentDate(), "TestSample");
$this->assertEquals($obj->getLastSentBy(), "TestSample");
$this->assertEquals($obj->getPayerViewUrl(), "http://www.google.com");
}
/**
* @depends testSerializationDeserialization
* @param Metadata $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCreated_date(), "TestSample");
$this->assertEquals($obj->getCreated_by(), "TestSample");
$this->assertEquals($obj->getCancelled_date(), "TestSample");
$this->assertEquals($obj->getCancelled_by(), "TestSample");
$this->assertEquals($obj->getLast_updated_date(), "TestSample");
$this->assertEquals($obj->getLast_updated_by(), "TestSample");
$this->assertEquals($obj->getFirst_sent_date(), "TestSample");
$this->assertEquals($obj->getLast_sent_date(), "TestSample");
$this->assertEquals($obj->getLast_sent_by(), "TestSample");
$this->assertEquals($obj->getPayer_view_url(), "http://www.google.com");
}
/**
* @depends testSerializationDeserialization
* @param Metadata $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Created_date
$obj->setCreatedDate(null);
$this->assertNull($obj->getCreated_date());
$this->assertNull($obj->getCreatedDate());
$this->assertSame($obj->getCreatedDate(), $obj->getCreated_date());
$obj->setCreated_date("TestSample");
$this->assertEquals($obj->getCreated_date(), "TestSample");
// Check for Created_by
$obj->setCreatedBy(null);
$this->assertNull($obj->getCreated_by());
$this->assertNull($obj->getCreatedBy());
$this->assertSame($obj->getCreatedBy(), $obj->getCreated_by());
$obj->setCreated_by("TestSample");
$this->assertEquals($obj->getCreated_by(), "TestSample");
// Check for Cancelled_date
$obj->setCancelledDate(null);
$this->assertNull($obj->getCancelled_date());
$this->assertNull($obj->getCancelledDate());
$this->assertSame($obj->getCancelledDate(), $obj->getCancelled_date());
$obj->setCancelled_date("TestSample");
$this->assertEquals($obj->getCancelled_date(), "TestSample");
// Check for Cancelled_by
$obj->setCancelledBy(null);
$this->assertNull($obj->getCancelled_by());
$this->assertNull($obj->getCancelledBy());
$this->assertSame($obj->getCancelledBy(), $obj->getCancelled_by());
$obj->setCancelled_by("TestSample");
$this->assertEquals($obj->getCancelled_by(), "TestSample");
// Check for Last_updated_date
$obj->setLastUpdatedDate(null);
$this->assertNull($obj->getLast_updated_date());
$this->assertNull($obj->getLastUpdatedDate());
$this->assertSame($obj->getLastUpdatedDate(), $obj->getLast_updated_date());
$obj->setLast_updated_date("TestSample");
$this->assertEquals($obj->getLast_updated_date(), "TestSample");
// Check for Last_updated_by
$obj->setLastUpdatedBy(null);
$this->assertNull($obj->getLast_updated_by());
$this->assertNull($obj->getLastUpdatedBy());
$this->assertSame($obj->getLastUpdatedBy(), $obj->getLast_updated_by());
$obj->setLast_updated_by("TestSample");
$this->assertEquals($obj->getLast_updated_by(), "TestSample");
// Check for First_sent_date
$obj->setFirstSentDate(null);
$this->assertNull($obj->getFirst_sent_date());
$this->assertNull($obj->getFirstSentDate());
$this->assertSame($obj->getFirstSentDate(), $obj->getFirst_sent_date());
$obj->setFirst_sent_date("TestSample");
$this->assertEquals($obj->getFirst_sent_date(), "TestSample");
// Check for Last_sent_date
$obj->setLastSentDate(null);
$this->assertNull($obj->getLast_sent_date());
$this->assertNull($obj->getLastSentDate());
$this->assertSame($obj->getLastSentDate(), $obj->getLast_sent_date());
$obj->setLast_sent_date("TestSample");
$this->assertEquals($obj->getLast_sent_date(), "TestSample");
// Check for Last_sent_by
$obj->setLastSentBy(null);
$this->assertNull($obj->getLast_sent_by());
$this->assertNull($obj->getLastSentBy());
$this->assertSame($obj->getLastSentBy(), $obj->getLast_sent_by());
$obj->setLast_sent_by("TestSample");
$this->assertEquals($obj->getLast_sent_by(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage PayerViewUrl is not a fully qualified URL
*/
public function testUrlValidationForPayerViewUrl()
{
$obj = new Metadata();
$obj->setPayerViewUrl(null);
}
public function testUrlValidationForPayerViewUrlDeprecated()
{
$obj = new Metadata();
$obj->setPayer_view_url(null);
$this->assertNull($obj->getPayer_view_url());
}
}

View File

@@ -0,0 +1,91 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Notification;
/**
* Class Notification
*
* @package PayPal\Test\Api
*/
class NotificationTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Notification
* @return string
*/
public static function getJson()
{
return '{"subject":"TestSample","note":"TestSample","send_to_merchant":true}';
}
/**
* Gets Object Instance with Json data filled in
* @return Notification
*/
public static function getObject()
{
return new Notification(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Notification
*/
public function testSerializationDeserialization()
{
$obj = new Notification(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getSubject());
$this->assertNotNull($obj->getNote());
$this->assertNotNull($obj->getSendToMerchant());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Notification $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getSubject(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
$this->assertEquals($obj->getSendToMerchant(), true);
}
/**
* @depends testSerializationDeserialization
* @param Notification $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getSend_to_merchant(), true);
}
/**
* @depends testSerializationDeserialization
* @param Notification $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Send_to_merchant
$obj->setSendToMerchant(null);
$this->assertNull($obj->getSend_to_merchant());
$this->assertNull($obj->getSendToMerchant());
$this->assertSame($obj->getSendToMerchant(), $obj->getSend_to_merchant());
$obj->setSend_to_merchant(true);
$this->assertEquals($obj->getSend_to_merchant(), true);
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\PaymentDetail;
/**
* Class PaymentDetail
*
* @package PayPal\Test\Api
*/
class PaymentDetailTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentDetail
* @return string
*/
public static function getJson()
{
return '{"type":"TestSample","transaction_id":"TestSample","transaction_type":"TestSample","date":"TestSample","method":"TestSample","note":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return PaymentDetail
*/
public static function getObject()
{
return new PaymentDetail(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PaymentDetail
*/
public function testSerializationDeserialization()
{
$obj = new PaymentDetail(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getTransactionId());
$this->assertNotNull($obj->getTransactionType());
$this->assertNotNull($obj->getDate());
$this->assertNotNull($obj->getMethod());
$this->assertNotNull($obj->getNote());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentDetail $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getTransactionId(), "TestSample");
$this->assertEquals($obj->getTransactionType(), "TestSample");
$this->assertEquals($obj->getDate(), "TestSample");
$this->assertEquals($obj->getMethod(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param PaymentDetail $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getTransaction_id(), "TestSample");
$this->assertEquals($obj->getTransaction_type(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param PaymentDetail $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");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,98 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\PaymentTerm;
/**
* Class PaymentTerm
*
* @package PayPal\Test\Api
*/
class PaymentTermTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentTerm
* @return string
*/
public static function getJson()
{
return '{"term_type":"TestSample","due_date":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return PaymentTerm
*/
public static function getObject()
{
return new PaymentTerm(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PaymentTerm
*/
public function testSerializationDeserialization()
{
$obj = new PaymentTerm(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getTermType());
$this->assertNotNull($obj->getDueDate());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentTerm $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getTermType(), "TestSample");
$this->assertEquals($obj->getDueDate(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param PaymentTerm $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getTerm_type(), "TestSample");
$this->assertEquals($obj->getDue_date(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param PaymentTerm $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Term_type
$obj->setTermType(null);
$this->assertNull($obj->getTerm_type());
$this->assertNull($obj->getTermType());
$this->assertSame($obj->getTermType(), $obj->getTerm_type());
$obj->setTerm_type("TestSample");
$this->assertEquals($obj->getTerm_type(), "TestSample");
// Check for Due_date
$obj->setDueDate(null);
$this->assertNull($obj->getDue_date());
$this->assertNull($obj->getDueDate());
$this->assertSame($obj->getDueDate(), $obj->getDue_date());
$obj->setDue_date("TestSample");
$this->assertEquals($obj->getDue_date(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,98 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Phone;
/**
* Class Phone
*
* @package PayPal\Test\Api
*/
class PhoneTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Phone
* @return string
*/
public static function getJson()
{
return '{"country_code":"TestSample","national_number":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Phone
*/
public static function getObject()
{
return new Phone(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Phone
*/
public function testSerializationDeserialization()
{
$obj = new Phone(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCountryCode());
$this->assertNotNull($obj->getNationalNumber());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Phone $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCountryCode(), "TestSample");
$this->assertEquals($obj->getNationalNumber(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Phone $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCountry_code(), "TestSample");
$this->assertEquals($obj->getNational_number(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Phone $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 National_number
$obj->setNationalNumber(null);
$this->assertNull($obj->getNational_number());
$this->assertNull($obj->getNationalNumber());
$this->assertSame($obj->getNationalNumber(), $obj->getNational_number());
$obj->setNational_number("TestSample");
$this->assertEquals($obj->getNational_number(), "TestSample");
//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\RefundDetail;
/**
* Class RefundDetail
*
* @package PayPal\Test\Api
*/
class RefundDetailTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object RefundDetail
* @return string
*/
public static function getJson()
{
return '{"type":"TestSample","date":"TestSample","note":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return RefundDetail
*/
public static function getObject()
{
return new RefundDetail(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return RefundDetail
*/
public function testSerializationDeserialization()
{
$obj = new RefundDetail(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getDate());
$this->assertNotNull($obj->getNote());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param RefundDetail $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getDate(), "TestSample");
$this->assertEquals($obj->getNote(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param RefundDetail $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param RefundDetail $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,249 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Search;
/**
* Class Search
*
* @package PayPal\Test\Api
*/
class SearchTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Search
* @return string
*/
public static function getJson()
{
return '{"email":"TestSample","recipient_first_name":"TestSample","recipient_last_name":"TestSample","recipient_business_name":"TestSample","number":"TestSample","status":"TestSample","lower_total_amount":' .CurrencyTest::getJson() . ',"upper_total_amount":' .CurrencyTest::getJson() . ',"start_invoice_date":"TestSample","end_invoice_date":"TestSample","start_due_date":"TestSample","end_due_date":"TestSample","start_payment_date":"TestSample","end_payment_date":"TestSample","start_creation_date":"TestSample","end_creation_date":"TestSample","page":"12.34","page_size":"12.34","total_count_required":true}';
}
/**
* Gets Object Instance with Json data filled in
* @return Search
*/
public static function getObject()
{
return new Search(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Search
*/
public function testSerializationDeserialization()
{
$obj = new Search(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getEmail());
$this->assertNotNull($obj->getRecipientFirstName());
$this->assertNotNull($obj->getRecipientLastName());
$this->assertNotNull($obj->getRecipientBusinessName());
$this->assertNotNull($obj->getNumber());
$this->assertNotNull($obj->getStatus());
$this->assertNotNull($obj->getLowerTotalAmount());
$this->assertNotNull($obj->getUpperTotalAmount());
$this->assertNotNull($obj->getStartInvoiceDate());
$this->assertNotNull($obj->getEndInvoiceDate());
$this->assertNotNull($obj->getStartDueDate());
$this->assertNotNull($obj->getEndDueDate());
$this->assertNotNull($obj->getStartPaymentDate());
$this->assertNotNull($obj->getEndPaymentDate());
$this->assertNotNull($obj->getStartCreationDate());
$this->assertNotNull($obj->getEndCreationDate());
$this->assertNotNull($obj->getPage());
$this->assertNotNull($obj->getPageSize());
$this->assertNotNull($obj->getTotalCountRequired());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Search $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getEmail(), "TestSample");
$this->assertEquals($obj->getRecipientFirstName(), "TestSample");
$this->assertEquals($obj->getRecipientLastName(), "TestSample");
$this->assertEquals($obj->getRecipientBusinessName(), "TestSample");
$this->assertEquals($obj->getNumber(), "TestSample");
$this->assertEquals($obj->getStatus(), "TestSample");
$this->assertEquals($obj->getLowerTotalAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getUpperTotalAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getStartInvoiceDate(), "TestSample");
$this->assertEquals($obj->getEndInvoiceDate(), "TestSample");
$this->assertEquals($obj->getStartDueDate(), "TestSample");
$this->assertEquals($obj->getEndDueDate(), "TestSample");
$this->assertEquals($obj->getStartPaymentDate(), "TestSample");
$this->assertEquals($obj->getEndPaymentDate(), "TestSample");
$this->assertEquals($obj->getStartCreationDate(), "TestSample");
$this->assertEquals($obj->getEndCreationDate(), "TestSample");
$this->assertEquals($obj->getPage(), "12.34");
$this->assertEquals($obj->getPageSize(), "12.34");
$this->assertEquals($obj->getTotalCountRequired(), true);
}
/**
* @depends testSerializationDeserialization
* @param Search $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getRecipient_first_name(), "TestSample");
$this->assertEquals($obj->getRecipient_last_name(), "TestSample");
$this->assertEquals($obj->getRecipient_business_name(), "TestSample");
$this->assertEquals($obj->getLower_total_amount(), CurrencyTest::getObject());
$this->assertEquals($obj->getUpper_total_amount(), CurrencyTest::getObject());
$this->assertEquals($obj->getStart_invoice_date(), "TestSample");
$this->assertEquals($obj->getEnd_invoice_date(), "TestSample");
$this->assertEquals($obj->getStart_due_date(), "TestSample");
$this->assertEquals($obj->getEnd_due_date(), "TestSample");
$this->assertEquals($obj->getStart_payment_date(), "TestSample");
$this->assertEquals($obj->getEnd_payment_date(), "TestSample");
$this->assertEquals($obj->getStart_creation_date(), "TestSample");
$this->assertEquals($obj->getEnd_creation_date(), "TestSample");
$this->assertEquals($obj->getPage_size(), "12.34");
$this->assertEquals($obj->getTotal_count_required(), true);
}
/**
* @depends testSerializationDeserialization
* @param Search $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Recipient_first_name
$obj->setRecipientFirstName(null);
$this->assertNull($obj->getRecipient_first_name());
$this->assertNull($obj->getRecipientFirstName());
$this->assertSame($obj->getRecipientFirstName(), $obj->getRecipient_first_name());
$obj->setRecipient_first_name("TestSample");
$this->assertEquals($obj->getRecipient_first_name(), "TestSample");
// Check for Recipient_last_name
$obj->setRecipientLastName(null);
$this->assertNull($obj->getRecipient_last_name());
$this->assertNull($obj->getRecipientLastName());
$this->assertSame($obj->getRecipientLastName(), $obj->getRecipient_last_name());
$obj->setRecipient_last_name("TestSample");
$this->assertEquals($obj->getRecipient_last_name(), "TestSample");
// Check for Recipient_business_name
$obj->setRecipientBusinessName(null);
$this->assertNull($obj->getRecipient_business_name());
$this->assertNull($obj->getRecipientBusinessName());
$this->assertSame($obj->getRecipientBusinessName(), $obj->getRecipient_business_name());
$obj->setRecipient_business_name("TestSample");
$this->assertEquals($obj->getRecipient_business_name(), "TestSample");
// Check for Lower_total_amount
$obj->setLowerTotalAmount(null);
$this->assertNull($obj->getLower_total_amount());
$this->assertNull($obj->getLowerTotalAmount());
$this->assertSame($obj->getLowerTotalAmount(), $obj->getLower_total_amount());
$obj->setLower_total_amount(CurrencyTest::getObject());
$this->assertEquals($obj->getLower_total_amount(), CurrencyTest::getObject());
// Check for Upper_total_amount
$obj->setUpperTotalAmount(null);
$this->assertNull($obj->getUpper_total_amount());
$this->assertNull($obj->getUpperTotalAmount());
$this->assertSame($obj->getUpperTotalAmount(), $obj->getUpper_total_amount());
$obj->setUpper_total_amount(CurrencyTest::getObject());
$this->assertEquals($obj->getUpper_total_amount(), CurrencyTest::getObject());
// Check for Start_invoice_date
$obj->setStartInvoiceDate(null);
$this->assertNull($obj->getStart_invoice_date());
$this->assertNull($obj->getStartInvoiceDate());
$this->assertSame($obj->getStartInvoiceDate(), $obj->getStart_invoice_date());
$obj->setStart_invoice_date("TestSample");
$this->assertEquals($obj->getStart_invoice_date(), "TestSample");
// Check for End_invoice_date
$obj->setEndInvoiceDate(null);
$this->assertNull($obj->getEnd_invoice_date());
$this->assertNull($obj->getEndInvoiceDate());
$this->assertSame($obj->getEndInvoiceDate(), $obj->getEnd_invoice_date());
$obj->setEnd_invoice_date("TestSample");
$this->assertEquals($obj->getEnd_invoice_date(), "TestSample");
// Check for Start_due_date
$obj->setStartDueDate(null);
$this->assertNull($obj->getStart_due_date());
$this->assertNull($obj->getStartDueDate());
$this->assertSame($obj->getStartDueDate(), $obj->getStart_due_date());
$obj->setStart_due_date("TestSample");
$this->assertEquals($obj->getStart_due_date(), "TestSample");
// Check for End_due_date
$obj->setEndDueDate(null);
$this->assertNull($obj->getEnd_due_date());
$this->assertNull($obj->getEndDueDate());
$this->assertSame($obj->getEndDueDate(), $obj->getEnd_due_date());
$obj->setEnd_due_date("TestSample");
$this->assertEquals($obj->getEnd_due_date(), "TestSample");
// Check for Start_payment_date
$obj->setStartPaymentDate(null);
$this->assertNull($obj->getStart_payment_date());
$this->assertNull($obj->getStartPaymentDate());
$this->assertSame($obj->getStartPaymentDate(), $obj->getStart_payment_date());
$obj->setStart_payment_date("TestSample");
$this->assertEquals($obj->getStart_payment_date(), "TestSample");
// Check for End_payment_date
$obj->setEndPaymentDate(null);
$this->assertNull($obj->getEnd_payment_date());
$this->assertNull($obj->getEndPaymentDate());
$this->assertSame($obj->getEndPaymentDate(), $obj->getEnd_payment_date());
$obj->setEnd_payment_date("TestSample");
$this->assertEquals($obj->getEnd_payment_date(), "TestSample");
// Check for Start_creation_date
$obj->setStartCreationDate(null);
$this->assertNull($obj->getStart_creation_date());
$this->assertNull($obj->getStartCreationDate());
$this->assertSame($obj->getStartCreationDate(), $obj->getStart_creation_date());
$obj->setStart_creation_date("TestSample");
$this->assertEquals($obj->getStart_creation_date(), "TestSample");
// Check for End_creation_date
$obj->setEndCreationDate(null);
$this->assertNull($obj->getEnd_creation_date());
$this->assertNull($obj->getEndCreationDate());
$this->assertSame($obj->getEndCreationDate(), $obj->getEnd_creation_date());
$obj->setEnd_creation_date("TestSample");
$this->assertEquals($obj->getEnd_creation_date(), "TestSample");
// Check for Page_size
$obj->setPageSize(null);
$this->assertNull($obj->getPage_size());
$this->assertNull($obj->getPageSize());
$this->assertSame($obj->getPageSize(), $obj->getPage_size());
$obj->setPage_size("12.34");
$this->assertEquals($obj->getPage_size(), "12.34");
// Check for Total_count_required
$obj->setTotalCountRequired(null);
$this->assertNull($obj->getTotal_count_required());
$this->assertNull($obj->getTotalCountRequired());
$this->assertSame($obj->getTotalCountRequired(), $obj->getTotal_count_required());
$obj->setTotal_count_required(true);
$this->assertEquals($obj->getTotal_count_required(), true);
//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\ShippingCost;
/**
* Class ShippingCost
*
* @package PayPal\Test\Api
*/
class ShippingCostTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object ShippingCost
* @return string
*/
public static function getJson()
{
return '{"amount":' .CurrencyTest::getJson() . ',"tax":' .TaxTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return ShippingCost
*/
public static function getObject()
{
return new ShippingCost(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return ShippingCost
*/
public function testSerializationDeserialization()
{
$obj = new ShippingCost(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getTax());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param ShippingCost $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getTax(), TaxTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param ShippingCost $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param ShippingCost $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,111 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\ShippingInfo;
/**
* Class ShippingInfo
*
* @package PayPal\Test\Api
*/
class ShippingInfoTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object ShippingInfo
* @return string
*/
public static function getJson()
{
return '{"first_name":"TestSample","last_name":"TestSample","business_name":"TestSample","address":' .AddressTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return ShippingInfo
*/
public static function getObject()
{
return new ShippingInfo(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return ShippingInfo
*/
public function testSerializationDeserialization()
{
$obj = new ShippingInfo(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getBusinessName());
$this->assertNotNull($obj->getAddress());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param ShippingInfo $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getBusinessName(), "TestSample");
$this->assertEquals($obj->getAddress(), AddressTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param ShippingInfo $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getFirst_name(), "TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
$this->assertEquals($obj->getBusiness_name(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param ShippingInfo $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// 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 Business_name
$obj->setBusinessName(null);
$this->assertNull($obj->getBusiness_name());
$this->assertNull($obj->getBusinessName());
$this->assertSame($obj->getBusinessName(), $obj->getBusiness_name());
$obj->setBusiness_name("TestSample");
$this->assertEquals($obj->getBusiness_name(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,84 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Tax;
/**
* Class Tax
*
* @package PayPal\Test\Api
*/
class TaxTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Tax
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","name":"TestSample","percent":"12.34","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return Tax
*/
public static function getObject()
{
return new Tax(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Tax
*/
public function testSerializationDeserialization()
{
$obj = new Tax(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getPercent());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Tax $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getPercent(), "12.34");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param Tax $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param Tax $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}