forked from LiveCarta/PayPal-PHP-SDK
Payments API Updates
This commit is contained in:
@@ -13,6 +13,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Address
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Address
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Address
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -68,4 +71,5 @@ class AddressTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getStatus(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
61
tests/PayPal/Test/Api/AlternatePaymentTest.php
Normal file
61
tests/PayPal/Test/Api/AlternatePaymentTest.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\AlternatePayment;
|
||||
|
||||
/**
|
||||
* Class AlternatePayment
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class AlternatePaymentTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object AlternatePayment
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"alternate_payment_account_id":"TestSample","external_customer_id":"TestSample","alternate_payment_provider_id":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return AlternatePayment
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new AlternatePayment(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return AlternatePayment
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new AlternatePayment(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getAlternatePaymentAccountId());
|
||||
$this->assertNotNull($obj->getExternalCustomerId());
|
||||
$this->assertNotNull($obj->getAlternatePaymentProviderId());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param AlternatePayment $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getAlternatePaymentAccountId(), "TestSample");
|
||||
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
|
||||
$this->assertEquals($obj->getAlternatePaymentProviderId(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,15 +13,17 @@ class AmountTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Amount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"currency":"TestSample","total":"12.34","details":' .DetailsTest::getJson() . '}';
|
||||
return '{"currency":"TestSample","total":"12.34","details":' . DetailsTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Amount
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class AmountTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Amount
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -56,4 +59,5 @@ class AmountTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getDetails(), DetailsTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -14,15 +14,17 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Authorization
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","amount":' .AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","fmf_details":' .FmfDetailsTest::getJson() . ',"parent_payment":"TestSample","valid_until":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}';
|
||||
return '{"id":"TestSample","amount":' . AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","fmf_details":' . FmfDetailsTest::getJson() . ',"parent_payment":"TestSample","valid_until":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Authorization
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -33,6 +35,7 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Authorization
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -79,7 +82,6 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Authorization $obj
|
||||
@@ -93,12 +95,13 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
AuthorizationTest::getJson()
|
||||
AuthorizationTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("authorizationId", $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Authorization $obj
|
||||
@@ -112,13 +115,14 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
CaptureTest::getJson()
|
||||
CaptureTest::getJson()
|
||||
));
|
||||
$capture = CaptureTest::getObject();
|
||||
|
||||
$result = $obj->capture($capture, $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Authorization $obj
|
||||
@@ -132,12 +136,13 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->void($mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Authorization $obj
|
||||
@@ -151,7 +156,7 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->reauthorize($mockApiContext, $mockPPRestCall);
|
||||
@@ -162,8 +167,8 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$obj = self::getObject();
|
||||
$mockApiContext = $this->getMockBuilder('ApiContext')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
return array(
|
||||
array($obj, $mockApiContext),
|
||||
array($obj, null)
|
||||
|
||||
@@ -13,15 +13,17 @@ 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() . '}';
|
||||
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()
|
||||
@@ -32,6 +34,7 @@ class BankAccountTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return BankAccount
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -98,93 +101,5 @@ class BankAccountTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param BankAccount $obj
|
||||
*/
|
||||
public function testCreate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param BankAccount $obj
|
||||
*/
|
||||
public function testGet($obj, $mockApiContext)
|
||||
{
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
BankAccountTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("bankAccountId", $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param BankAccount $obj
|
||||
*/
|
||||
public function testDelete($obj, $mockApiContext)
|
||||
{
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
));
|
||||
|
||||
$result = $obj->delete($mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param BankAccount $obj
|
||||
*/
|
||||
public function testUpdate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
$patchRequest = PatchRequestTest::getObject();
|
||||
|
||||
$result = $obj->update($patchRequest, $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
public function mockProvider()
|
||||
{
|
||||
$obj = self::getObject();
|
||||
$mockApiContext = $this->getMockBuilder('ApiContext')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
return array(
|
||||
array($obj, $mockApiContext),
|
||||
array($obj, null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class BankTokenTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object BankToken
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class BankTokenTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return BankToken
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class BankTokenTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return BankToken
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -56,4 +59,5 @@ class BankTokenTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getMandateReferenceNumber(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
57
tests/PayPal/Test/Api/BillingTest.php
Normal file
57
tests/PayPal/Test/Api/BillingTest.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Billing;
|
||||
|
||||
/**
|
||||
* Class Billing
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class BillingTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Billing
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"billing_agreement_id":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return Billing
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new Billing(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return Billing
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new Billing(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getBillingAgreementId());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param Billing $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getBillingAgreementId(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -14,15 +14,17 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Capture
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","amount":' .AmountTest::getJson() . ',"is_final_capture":true,"state":"TestSample","parent_payment":"TestSample","transaction_fee":' .CurrencyTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}';
|
||||
return '{"id":"TestSample","amount":' . AmountTest::getJson() . ',"is_final_capture":true,"state":"TestSample","parent_payment":"TestSample","transaction_fee":' . CurrencyTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Capture
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -33,6 +35,7 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Capture
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -69,7 +72,6 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Capture $obj
|
||||
@@ -83,12 +85,13 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
CaptureTest::getJson()
|
||||
CaptureTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("captureId", $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Capture $obj
|
||||
@@ -102,7 +105,7 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
RefundTest::getJson()
|
||||
RefundTest::getJson()
|
||||
));
|
||||
$refund = RefundTest::getObject();
|
||||
|
||||
@@ -114,8 +117,8 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$obj = self::getObject();
|
||||
$mockApiContext = $this->getMockBuilder('ApiContext')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
return array(
|
||||
array($obj, $mockApiContext),
|
||||
array($obj, null)
|
||||
|
||||
65
tests/PayPal/Test/Api/CarrierAccountTest.php
Normal file
65
tests/PayPal/Test/Api/CarrierAccountTest.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\CarrierAccount;
|
||||
|
||||
/**
|
||||
* Class CarrierAccount
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class CarrierAccountTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object CarrierAccount
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","phone_number":"TestSample","external_customer_id":"TestSample","phone_source":"TestSample","country_code":' .CountryCodeTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return CarrierAccount
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new CarrierAccount(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return CarrierAccount
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new CarrierAccount(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getId());
|
||||
$this->assertNotNull($obj->getPhoneNumber());
|
||||
$this->assertNotNull($obj->getExternalCustomerId());
|
||||
$this->assertNotNull($obj->getPhoneSource());
|
||||
$this->assertNotNull($obj->getCountryCode());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param CarrierAccount $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getId(), "TestSample");
|
||||
$this->assertEquals($obj->getPhoneNumber(), "TestSample");
|
||||
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
|
||||
$this->assertEquals($obj->getPhoneSource(), "TestSample");
|
||||
$this->assertEquals($obj->getCountryCode(), CountryCodeTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ class CarrierAccountTokenTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object CarrierAccountToken
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class CarrierAccountTokenTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return CarrierAccountToken
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class CarrierAccountTokenTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return CarrierAccountToken
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -53,4 +56,6 @@ class CarrierAccountTokenTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getCarrierAccountId(), "TestSample");
|
||||
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object CartBase
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"amount":' .AmountTest::getJson() . ',"payee":' .PayeeTest::getJson() . ',"description":"TestSample","note_to_payee":"TestSample","custom":"TestSample","invoice_number":"TestSample","soft_descriptor":"TestSample","payment_options":' .PaymentOptionsTest::getJson() . ',"item_list":' .ItemListTest::getJson() . ',"notify_url":"http://www.google.com","order_url":"http://www.google.com"}';
|
||||
return '{"reference_id":"TestSample","amount":' . AmountTest::getJson() . ',"payee":' . PayeeTest::getJson() . ',"description":"TestSample","note_to_payee":"TestSample","custom":"TestSample","invoice_number":"TestSample","soft_descriptor":"TestSample","soft_descriptor_city":"TestSample","payment_options":' . PaymentOptionsTest::getJson() . ',"item_list":' . ItemListTest::getJson() . ',"notify_url":"http://www.google.com","order_url":"http://www.google.com","external_funding":' . ExternalFundingTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return CartBase
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,12 +34,14 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return CartBase
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new CartBase(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getReferenceId());
|
||||
$this->assertNotNull($obj->getAmount());
|
||||
$this->assertNotNull($obj->getPayee());
|
||||
$this->assertNotNull($obj->getDescription());
|
||||
@@ -45,10 +49,12 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getCustom());
|
||||
$this->assertNotNull($obj->getInvoiceNumber());
|
||||
$this->assertNotNull($obj->getSoftDescriptor());
|
||||
$this->assertNotNull($obj->getSoftDescriptorCity());
|
||||
$this->assertNotNull($obj->getPaymentOptions());
|
||||
$this->assertNotNull($obj->getItemList());
|
||||
$this->assertNotNull($obj->getNotifyUrl());
|
||||
$this->assertNotNull($obj->getOrderUrl());
|
||||
$this->assertNotNull($obj->getExternalFunding());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -59,6 +65,7 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getReferenceId(), "TestSample");
|
||||
$this->assertEquals($obj->getAmount(), AmountTest::getObject());
|
||||
$this->assertEquals($obj->getPayee(), PayeeTest::getObject());
|
||||
$this->assertEquals($obj->getDescription(), "TestSample");
|
||||
@@ -66,10 +73,12 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getCustom(), "TestSample");
|
||||
$this->assertEquals($obj->getInvoiceNumber(), "TestSample");
|
||||
$this->assertEquals($obj->getSoftDescriptor(), "TestSample");
|
||||
$this->assertEquals($obj->getSoftDescriptorCity(), "TestSample");
|
||||
$this->assertEquals($obj->getPaymentOptions(), PaymentOptionsTest::getObject());
|
||||
$this->assertEquals($obj->getItemList(), ItemListTest::getObject());
|
||||
$this->assertEquals($obj->getNotifyUrl(), "http://www.google.com");
|
||||
$this->assertEquals($obj->getOrderUrl(), "http://www.google.com");
|
||||
$this->assertEquals($obj->getExternalFunding(), ExternalFundingTest::getObject());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,6 +90,7 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
|
||||
$obj = new CartBase();
|
||||
$obj->setNotifyUrl(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage OrderUrl is not a fully qualified URL
|
||||
@@ -90,4 +100,5 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
|
||||
$obj = new CartBase();
|
||||
$obj->setOrderUrl(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
57
tests/PayPal/Test/Api/CountryCodeTest.php
Normal file
57
tests/PayPal/Test/Api/CountryCodeTest.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\CountryCode;
|
||||
|
||||
/**
|
||||
* Class CountryCode
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class CountryCodeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object CountryCode
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"country_code":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return CountryCode
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new CountryCode(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return CountryCode
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new CountryCode(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getCountryCode());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param CountryCode $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getCountryCode(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\CreditCard;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
|
||||
/**
|
||||
* Class CreditCard
|
||||
@@ -14,15 +13,17 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object CreditCard
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"cvv2":"TestSample","first_name":"TestSample","last_name":"TestSample","billing_address":' .AddressTest::getJson() . ',"external_customer_id":"TestSample","merchant_id":"TestSample","payer_id":"TestSample","external_card_id":"TestSample","state":"TestSample","create_time":"TestSample","update_time":"TestSample","valid_until":"TestSample","links":' .LinksTest::getJson() . '}';
|
||||
return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"cvv2":"TestSample","first_name":"TestSample","last_name":"TestSample","billing_address":' . AddressTest::getJson() . ',"external_customer_id":"TestSample","state":"TestSample","valid_until":"TestSample","links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return CreditCard
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -33,6 +34,7 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return CreditCard
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -49,12 +51,7 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getLastName());
|
||||
$this->assertNotNull($obj->getBillingAddress());
|
||||
$this->assertNotNull($obj->getExternalCustomerId());
|
||||
$this->assertNotNull($obj->getMerchantId());
|
||||
$this->assertNotNull($obj->getPayerId());
|
||||
$this->assertNotNull($obj->getExternalCardId());
|
||||
$this->assertNotNull($obj->getState());
|
||||
$this->assertNotNull($obj->getCreateTime());
|
||||
$this->assertNotNull($obj->getUpdateTime());
|
||||
$this->assertNotNull($obj->getValidUntil());
|
||||
$this->assertNotNull($obj->getLinks());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
@@ -77,123 +74,10 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getLastName(), "TestSample");
|
||||
$this->assertEquals($obj->getBillingAddress(), AddressTest::getObject());
|
||||
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
|
||||
$this->assertEquals($obj->getMerchantId(), "TestSample");
|
||||
$this->assertEquals($obj->getPayerId(), "TestSample");
|
||||
$this->assertEquals($obj->getExternalCardId(), "TestSample");
|
||||
$this->assertEquals($obj->getState(), "TestSample");
|
||||
$this->assertEquals($obj->getCreateTime(), "TestSample");
|
||||
$this->assertEquals($obj->getUpdateTime(), "TestSample");
|
||||
$this->assertEquals($obj->getValidUntil(), "TestSample");
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param CreditCard $obj
|
||||
*/
|
||||
public function testCreate($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->create($mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param CreditCard $obj
|
||||
*/
|
||||
public function testGet($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->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\PayPalRestCall')
|
||||
->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\PayPalRestCall')
|
||||
->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 CreditCard $obj
|
||||
*/
|
||||
public function testList($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
CreditCardListTest::getJson()
|
||||
));
|
||||
$params = array();
|
||||
|
||||
$result = $obj->all($params, $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
public function mockProvider()
|
||||
{
|
||||
$obj = self::getObject();
|
||||
$mockApiContext = $this->getMockBuilder('ApiContext')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
return array(
|
||||
array($obj, $mockApiContext),
|
||||
array($obj, null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class CreditCardTokenTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object CreditCardToken
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class CreditCardTokenTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return CreditCardToken
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class CreditCardTokenTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return CreditCardToken
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -62,4 +65,5 @@ class CreditCardTokenTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getExpireYear(), 123);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
67
tests/PayPal/Test/Api/CreditFinancingOfferedTest.php
Normal file
67
tests/PayPal/Test/Api/CreditFinancingOfferedTest.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\CreditFinancingOffered;
|
||||
|
||||
/**
|
||||
* Class CreditFinancingOffered
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class CreditFinancingOfferedTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object CreditFinancingOffered
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"total_cost":' .CurrencyTest::getJson() . ',"term":"12.34","monthly_payment":' .CurrencyTest::getJson() . ',"total_interest":' .CurrencyTest::getJson() . ',"payer_acceptance":true,"cart_amount_immutable":true}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return CreditFinancingOffered
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new CreditFinancingOffered(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return CreditFinancingOffered
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new CreditFinancingOffered(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getTotalCost());
|
||||
$this->assertNotNull($obj->getTerm());
|
||||
$this->assertNotNull($obj->getMonthlyPayment());
|
||||
$this->assertNotNull($obj->getTotalInterest());
|
||||
$this->assertNotNull($obj->getPayerAcceptance());
|
||||
$this->assertNotNull($obj->getCartAmountImmutable());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param CreditFinancingOffered $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getTotalCost(), CurrencyTest::getObject());
|
||||
$this->assertEquals($obj->getTerm(), "12.34");
|
||||
$this->assertEquals($obj->getMonthlyPayment(), CurrencyTest::getObject());
|
||||
$this->assertEquals($obj->getTotalInterest(), CurrencyTest::getObject());
|
||||
$this->assertEquals($obj->getPayerAcceptance(), true);
|
||||
$this->assertEquals($obj->getCartAmountImmutable(), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ class CreditTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Credit
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class CreditTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Credit
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class CreditTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Credit
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -54,4 +57,5 @@ class CreditTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getType(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class CurrencyConversionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object CurrencyConversion
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"conversion_date":"TestSample","from_currency":"TestSample","from_amount":"TestSample","to_currency":"TestSample","to_amount":"TestSample","conversion_type":"TestSample","conversion_type_changeable":true,"web_url":"http://www.google.com","links":' .LinksTest::getJson() . '}';
|
||||
return '{"conversion_date":"TestSample","from_currency":"TestSample","from_amount":"TestSample","to_currency":"TestSample","to_amount":"TestSample","conversion_type":"TestSample","conversion_type_changeable":true,"web_url":"http://www.google.com","links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return CurrencyConversion
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class CurrencyConversionTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return CurrencyConversion
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
|
||||
@@ -13,6 +13,7 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Currency
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Currency
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Currency
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -54,4 +57,5 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getValue(), "12.34");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class DetailsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Details
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class DetailsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Details
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class DetailsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Details
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -65,4 +68,6 @@ class DetailsTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getGiftWrap(), "12.34");
|
||||
$this->assertEquals($obj->getFee(), "12.34");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class ErrorDetailsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object ErrorDetails
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class ErrorDetailsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return ErrorDetails
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class ErrorDetailsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return ErrorDetails
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -58,4 +61,5 @@ class ErrorDetailsTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getCode(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class ErrorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Error
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"name":"TestSample","purchase_unit_reference_id":"TestSample","debug_id":"TestSample","message":"TestSample","code":"TestSample","information_link":"TestSample","details":' .ErrorDetailsTest::getJson() . ',"links":' .LinksTest::getJson() . '}';
|
||||
return '{"name":"TestSample","purchase_unit_reference_id":"TestSample","message":"TestSample","code":"TestSample","details":' . ErrorDetailsTest::getJson() . ',"processor_response":' . ProcessorResponseTest::getJson() . ',"fmf_details":' . FmfDetailsTest::getJson() . ',"information_link":"TestSample","debug_id":"TestSample","links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Error
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class ErrorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Error
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -40,11 +43,13 @@ class ErrorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getName());
|
||||
$this->assertNotNull($obj->getPurchaseUnitReferenceId());
|
||||
$this->assertNotNull($obj->getDebugId());
|
||||
$this->assertNotNull($obj->getMessage());
|
||||
$this->assertNotNull($obj->getCode());
|
||||
$this->assertNotNull($obj->getInformationLink());
|
||||
$this->assertNotNull($obj->getDetails());
|
||||
$this->assertNotNull($obj->getProcessorResponse());
|
||||
$this->assertNotNull($obj->getFmfDetails());
|
||||
$this->assertNotNull($obj->getInformationLink());
|
||||
$this->assertNotNull($obj->getDebugId());
|
||||
$this->assertNotNull($obj->getLinks());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
@@ -58,12 +63,15 @@ class ErrorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->assertEquals($obj->getName(), "TestSample");
|
||||
$this->assertEquals($obj->getPurchaseUnitReferenceId(), "TestSample");
|
||||
$this->assertEquals($obj->getDebugId(), "TestSample");
|
||||
$this->assertEquals($obj->getMessage(), "TestSample");
|
||||
$this->assertEquals($obj->getCode(), "TestSample");
|
||||
$this->assertEquals($obj->getInformationLink(), "TestSample");
|
||||
$this->assertEquals($obj->getDetails(), ErrorDetailsTest::getObject());
|
||||
$this->assertEquals($obj->getProcessorResponse(), ProcessorResponseTest::getObject());
|
||||
$this->assertEquals($obj->getFmfDetails(), FmfDetailsTest::getObject());
|
||||
$this->assertEquals($obj->getInformationLink(), "TestSample");
|
||||
$this->assertEquals($obj->getDebugId(), "TestSample");
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class ExtendedBankAccountTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object ExtendedBankAccount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class ExtendedBankAccountTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return ExtendedBankAccount
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class ExtendedBankAccountTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return ExtendedBankAccount
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -52,4 +55,5 @@ class ExtendedBankAccountTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getMandateReferenceNumber(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
65
tests/PayPal/Test/Api/ExternalFundingTest.php
Normal file
65
tests/PayPal/Test/Api/ExternalFundingTest.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\ExternalFunding;
|
||||
|
||||
/**
|
||||
* Class ExternalFunding
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class ExternalFundingTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object ExternalFunding
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"reference_id":"TestSample","code":"TestSample","funding_account_id":"TestSample","display_text":"TestSample","amount":' .AmountTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return ExternalFunding
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new ExternalFunding(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return ExternalFunding
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new ExternalFunding(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getReferenceId());
|
||||
$this->assertNotNull($obj->getCode());
|
||||
$this->assertNotNull($obj->getFundingAccountId());
|
||||
$this->assertNotNull($obj->getDisplayText());
|
||||
$this->assertNotNull($obj->getAmount());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param ExternalFunding $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getReferenceId(), "TestSample");
|
||||
$this->assertEquals($obj->getCode(), "TestSample");
|
||||
$this->assertEquals($obj->getFundingAccountId(), "TestSample");
|
||||
$this->assertEquals($obj->getDisplayText(), "TestSample");
|
||||
$this->assertEquals($obj->getAmount(), AmountTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ class FmfDetailsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object FmfDetails
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class FmfDetailsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return FmfDetails
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class FmfDetailsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return FmfDetails
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -58,4 +61,5 @@ class FmfDetailsTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getDescription(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class FundingDetailTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object FundingDetail
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"clearing_time":"TestSample","payment_hold_date":"TestSample"}';
|
||||
return '{"clearing_time":"TestSample","payment_hold_date":"TestSample","payment_debit_date":"TestSample","processing_type":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return FundingDetail
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class FundingDetailTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return FundingDetail
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -40,6 +43,8 @@ class FundingDetailTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getClearingTime());
|
||||
$this->assertNotNull($obj->getPaymentHoldDate());
|
||||
$this->assertNotNull($obj->getPaymentDebitDate());
|
||||
$this->assertNotNull($obj->getProcessingType());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -52,6 +57,9 @@ class FundingDetailTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->assertEquals($obj->getClearingTime(), "TestSample");
|
||||
$this->assertEquals($obj->getPaymentHoldDate(), "TestSample");
|
||||
$this->assertEquals($obj->getPaymentDebitDate(), "TestSample");
|
||||
$this->assertEquals($obj->getProcessingType(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class FundingInstrumentTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object FundingInstrument
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"credit_card":' .CreditCardTest::getJson() . ',"credit_card_token":' .CreditCardTokenTest::getJson() . ',"payment_card":' .PaymentCardTest::getJson() . ',"payment_card_token":' .PaymentCardTokenTest::getJson() . ',"bank_account":' .ExtendedBankAccountTest::getJson() . ',"bank_account_token":' .BankTokenTest::getJson() . ',"credit":' .CreditTest::getJson() . '}';
|
||||
return '{"credit_card":' . CreditCardTest::getJson() . ',"credit_card_token":' . CreditCardTokenTest::getJson() . ',"payment_card":' . PaymentCardTest::getJson() . ',"bank_account":' . ExtendedBankAccountTest::getJson() . ',"bank_account_token":' . BankTokenTest::getJson() . ',"credit":' . CreditTest::getJson() . ',"incentive":' . IncentiveTest::getJson() . ',"external_funding":' . ExternalFundingTest::getJson() . ',"carrier_account_token":' . CarrierAccountTokenTest::getJson() . ',"carrier_account":' . CarrierAccountTest::getJson() . ',"private_label_card":' . PrivateLabelCardTest::getJson() . ',"billing":' . BillingTest::getJson() . ',"alternate_payment":' . AlternatePaymentTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return FundingInstrument
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class FundingInstrumentTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return FundingInstrument
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -41,10 +44,16 @@ class FundingInstrumentTest extends \PHPUnit_Framework_TestCase
|
||||
$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->assertNotNull($obj->getIncentive());
|
||||
$this->assertNotNull($obj->getExternalFunding());
|
||||
$this->assertNotNull($obj->getCarrierAccountToken());
|
||||
$this->assertNotNull($obj->getCarrierAccount());
|
||||
$this->assertNotNull($obj->getPrivateLabelCard());
|
||||
$this->assertNotNull($obj->getBilling());
|
||||
$this->assertNotNull($obj->getAlternatePayment());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -58,10 +67,16 @@ class FundingInstrumentTest extends \PHPUnit_Framework_TestCase
|
||||
$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());
|
||||
$this->assertEquals($obj->getIncentive(), IncentiveTest::getObject());
|
||||
$this->assertEquals($obj->getExternalFunding(), ExternalFundingTest::getObject());
|
||||
$this->assertEquals($obj->getCarrierAccountToken(), CarrierAccountTokenTest::getObject());
|
||||
$this->assertEquals($obj->getCarrierAccount(), CarrierAccountTest::getObject());
|
||||
$this->assertEquals($obj->getPrivateLabelCard(), PrivateLabelCardTest::getObject());
|
||||
$this->assertEquals($obj->getBilling(), BillingTest::getObject());
|
||||
$this->assertEquals($obj->getAlternatePayment(), AlternatePaymentTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,15 +13,17 @@ class FundingOptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object FundingOption
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","funding_sources":' .FundingSourceTest::getJson() . ',"backup_funding_instrument":' .FundingInstrumentTest::getJson() . ',"currency_conversion":' .CurrencyConversionTest::getJson() . ',"installment_info":' .InstallmentInfoTest::getJson() . ',"links":' .LinksTest::getJson() . '}';
|
||||
return '{"id":"TestSample","funding_sources":' . FundingSourceTest::getJson() . ',"backup_funding_instrument":' . FundingInstrumentTest::getJson() . ',"currency_conversion":' . CurrencyConversionTest::getJson() . ',"installment_info":' . InstallmentInfoTest::getJson() . ',"links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return FundingOption
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class FundingOptionTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return FundingOption
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -61,4 +64,6 @@ class FundingOptionTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getInstallmentInfo(), InstallmentInfoTest::getObject());
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class FundingSourceTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object FundingSource
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"funding_mode":"TestSample","funding_instrument_type":"TestSample","soft_descriptor":"TestSample","amount":' .CurrencyTest::getJson() . ',"legal_text":"TestSample","funding_detail":' .FundingDetailTest::getJson() . ',"additional_text":"TestSample","extends":' .FundingInstrumentTest::getJson() . ',"links":' .LinksTest::getJson() . '}';
|
||||
return '{"funding_mode":"TestSample","funding_instrument_type":"TestSample","soft_descriptor":"TestSample","amount":' . CurrencyTest::getJson() . ',"legal_text":"TestSample","funding_detail":' . FundingDetailTest::getJson() . ',"additional_text":"TestSample","extends":' . FundingInstrumentTest::getJson() . ',"links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return FundingSource
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class FundingSourceTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return FundingSource
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -67,4 +70,6 @@ class FundingSourceTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getExtends(), FundingInstrumentTest::getObject());
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class IncentiveTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Incentive
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","code":"TestSample","name":"TestSample","description":"TestSample","minimum_purchase_amount":' .CurrencyTest::getJson() . ',"logo_image_url":"http://www.google.com","expiry_date":"TestSample","type":"TestSample","terms":"TestSample"}';
|
||||
return '{"id":"TestSample","code":"TestSample","name":"TestSample","description":"TestSample","minimum_purchase_amount":' . CurrencyTest::getJson() . ',"logo_image_url":"http://www.google.com","expiry_date":"TestSample","type":"TestSample","terms":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Incentive
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class IncentiveTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Incentive
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -77,4 +80,5 @@ class IncentiveTest extends \PHPUnit_Framework_TestCase
|
||||
$obj = new Incentive();
|
||||
$obj->setLogoImageUrl(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class InstallmentInfoTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object InstallmentInfo
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"installment_id":"TestSample","network":"TestSample","issuer":"TestSample","installment_options":' .InstallmentOptionTest::getJson() . '}';
|
||||
return '{"installment_id":"TestSample","network":"TestSample","issuer":"TestSample","installment_options":' . InstallmentOptionTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return InstallmentInfo
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class InstallmentInfoTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return InstallmentInfo
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -57,4 +60,6 @@ class InstallmentInfoTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getIssuer(), "TestSample");
|
||||
$this->assertEquals($obj->getInstallmentOptions(), InstallmentOptionTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class InstallmentOptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object InstallmentOption
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"term":123,"monthly_payment":' .CurrencyTest::getJson() . ',"discount_amount":' .CurrencyTest::getJson() . ',"discount_percentage":"12.34"}';
|
||||
return '{"term":123,"monthly_payment":' . CurrencyTest::getJson() . ',"discount_amount":' . CurrencyTest::getJson() . ',"discount_percentage":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return InstallmentOption
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class InstallmentOptionTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return InstallmentOption
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -55,6 +58,8 @@ class InstallmentOptionTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getTerm(), 123);
|
||||
$this->assertEquals($obj->getMonthlyPayment(), CurrencyTest::getObject());
|
||||
$this->assertEquals($obj->getDiscountAmount(), CurrencyTest::getObject());
|
||||
$this->assertEquals($obj->getDiscountPercentage(), "12.34");
|
||||
$this->assertEquals($obj->getDiscountPercentage(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class ItemListTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object ItemList
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"items":' .ItemTest::getJson() . ',"shipping_address":' .ShippingAddressTest::getJson() . ',"shipping_method":"TestSample"}';
|
||||
return '{"items":' . ItemTest::getJson() . ',"shipping_address":' . ShippingAddressTest::getJson() . ',"shipping_method":"TestSample","shipping_phone_number":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return ItemList
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class ItemListTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return ItemList
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -41,6 +44,7 @@ class ItemListTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getItems());
|
||||
$this->assertNotNull($obj->getShippingAddress());
|
||||
$this->assertNotNull($obj->getShippingMethod());
|
||||
$this->assertNotNull($obj->getShippingPhoneNumber());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -54,6 +58,8 @@ class ItemListTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getItems(), ItemTest::getObject());
|
||||
$this->assertEquals($obj->getShippingAddress(), ShippingAddressTest::getObject());
|
||||
$this->assertEquals($obj->getShippingMethod(), "TestSample");
|
||||
$this->assertEquals($obj->getShippingPhoneNumber(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class ItemTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Item
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"quantity":"TestSample","name":"TestSample","description":"TestSample","price":"12.34","tax":"12.34","currency":"TestSample","sku":"TestSample","url":"http://www.google.com","category":"TestSample","weight":' .MeasurementTest::getJson() . ',"length":' .MeasurementTest::getJson() . ',"height":' .MeasurementTest::getJson() . ',"width":' .MeasurementTest::getJson() . ',"supplementary_data":' .NameValuePairTest::getJson() . ',"postback_data":' .NameValuePairTest::getJson() . '}';
|
||||
return '{"sku":"TestSample","name":"TestSample","description":"TestSample","quantity":"12.34","price":"12.34","currency":"TestSample","tax":"12.34","url":"http://www.google.com","category":"TestSample","weight":' . MeasurementTest::getJson() . ',"length":' . MeasurementTest::getJson() . ',"height":' . MeasurementTest::getJson() . ',"width":' . MeasurementTest::getJson() . ',"supplementary_data":' . NameValuePairTest::getJson() . ',"postback_data":' . NameValuePairTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Item
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,19 +34,20 @@ class ItemTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Item
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new Item(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getQuantity());
|
||||
$this->assertNotNull($obj->getSku());
|
||||
$this->assertNotNull($obj->getName());
|
||||
$this->assertNotNull($obj->getDescription());
|
||||
$this->assertNotNull($obj->getQuantity());
|
||||
$this->assertNotNull($obj->getPrice());
|
||||
$this->assertNotNull($obj->getTax());
|
||||
$this->assertNotNull($obj->getCurrency());
|
||||
$this->assertNotNull($obj->getSku());
|
||||
$this->assertNotNull($obj->getTax());
|
||||
$this->assertNotNull($obj->getUrl());
|
||||
$this->assertNotNull($obj->getCategory());
|
||||
$this->assertNotNull($obj->getWeight());
|
||||
@@ -63,13 +66,13 @@ class ItemTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getQuantity(), "TestSample");
|
||||
$this->assertEquals($obj->getSku(), "TestSample");
|
||||
$this->assertEquals($obj->getName(), "TestSample");
|
||||
$this->assertEquals($obj->getDescription(), "TestSample");
|
||||
$this->assertEquals($obj->getQuantity(), "12.34");
|
||||
$this->assertEquals($obj->getPrice(), "12.34");
|
||||
$this->assertEquals($obj->getTax(), "12.34");
|
||||
$this->assertEquals($obj->getCurrency(), "TestSample");
|
||||
$this->assertEquals($obj->getSku(), "TestSample");
|
||||
$this->assertEquals($obj->getTax(), "12.34");
|
||||
$this->assertEquals($obj->getUrl(), "http://www.google.com");
|
||||
$this->assertEquals($obj->getCategory(), "TestSample");
|
||||
$this->assertEquals($obj->getWeight(), MeasurementTest::getObject());
|
||||
|
||||
@@ -13,6 +13,7 @@ class MeasurementTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Measurement
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class MeasurementTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Measurement
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class MeasurementTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Measurement
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -54,4 +57,5 @@ class MeasurementTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getUnit(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class NameValuePairTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object NameValuePair
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class NameValuePairTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return NameValuePair
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class NameValuePairTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return NameValuePair
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -54,4 +57,5 @@ class NameValuePairTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getValue(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\Authorization;
|
||||
use PayPal\Api\Order;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
|
||||
/**
|
||||
* Class Order
|
||||
@@ -15,15 +14,17 @@ class OrderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Order
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","purchase_unit_reference_id":"TestSample","amount":' .AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection-eligibility":"TestSample","protection-eligibility_type":"TestSample","parent_payment":"TestSample","fmf_details":' .FmfDetailsTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}';
|
||||
return '{"id":"TestSample","purchase_unit_reference_id":"TestSample","amount":' . AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","parent_payment":"TestSample","fmf_details":' . FmfDetailsTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Order
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -34,6 +35,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Order
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -80,7 +82,6 @@ class OrderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Order $obj
|
||||
@@ -94,12 +95,13 @@ class OrderTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
OrderTest::getJson()
|
||||
OrderTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("orderId", $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Order $obj
|
||||
@@ -113,13 +115,14 @@ class OrderTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
CaptureTest::getJson()
|
||||
CaptureTest::getJson()
|
||||
));
|
||||
$capture = CaptureTest::getObject();
|
||||
|
||||
$result = $obj->capture($capture, $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Order $obj
|
||||
@@ -133,12 +136,13 @@ class OrderTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->void($mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Order $obj
|
||||
@@ -152,7 +156,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
AuthorizationTest::getJson()
|
||||
AuthorizationTest::getJson()
|
||||
));
|
||||
|
||||
$authorization = new Authorization();
|
||||
@@ -164,8 +168,8 @@ class OrderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$obj = self::getObject();
|
||||
$mockApiContext = $this->getMockBuilder('ApiContext')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
return array(
|
||||
array($obj, $mockApiContext),
|
||||
array($obj, null)
|
||||
|
||||
@@ -13,6 +13,7 @@ class PatchTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Patch
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class PatchTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Patch
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class PatchTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Patch
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -58,4 +61,5 @@ class PatchTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getFrom(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class PayeeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Payee
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"email":"TestSample","merchant_id":"TestSample"}';
|
||||
return '{"email":"TestSample","merchant_id":"TestSample","first_name":"TestSample","last_name":"TestSample","account_number":"TestSample","phone":' . PhoneTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Payee
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class PayeeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Payee
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -40,6 +43,10 @@ class PayeeTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getEmail());
|
||||
$this->assertNotNull($obj->getMerchantId());
|
||||
$this->assertNotNull($obj->getFirstName());
|
||||
$this->assertNotNull($obj->getLastName());
|
||||
$this->assertNotNull($obj->getAccountNumber());
|
||||
$this->assertNotNull($obj->getPhone());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -52,5 +59,11 @@ class PayeeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->assertEquals($obj->getEmail(), "TestSample");
|
||||
$this->assertEquals($obj->getMerchantId(), "TestSample");
|
||||
$this->assertEquals($obj->getFirstName(), "TestSample");
|
||||
$this->assertEquals($obj->getLastName(), "TestSample");
|
||||
$this->assertEquals($obj->getAccountNumber(), "TestSample");
|
||||
$this->assertEquals($obj->getPhone(), PhoneTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object PayerInfo
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"email":"TestSample","external_remember_me_id":"TestSample","buyer_account_number":"TestSample","salutation":"TestSample","first_name":"TestSample","middle_name":"TestSample","last_name":"TestSample","suffix":"TestSample","payer_id":"TestSample","phone":"TestSample","phone_type":"TestSample","birth_date":"TestSample","tax_id":"TestSample","tax_id_type":"TestSample","country_code":"TestSample","billing_address":' .AddressTest::getJson() . ',"shipping_address":' .ShippingAddressTest::getJson() . '}';
|
||||
return '{"email":"TestSample","external_remember_me_id":"TestSample","account_number":"TestSample","salutation":"TestSample","first_name":"TestSample","middle_name":"TestSample","last_name":"TestSample","suffix":"TestSample","payer_id":"TestSample","phone":"TestSample","phone_type":"TestSample","birth_date":"TestSample","tax_id":"TestSample","tax_id_type":"TestSample","country_code":"TestSample","billing_address":' . AddressTest::getJson() . ',"shipping_address":' . ShippingAddressTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return PayerInfo
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return PayerInfo
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -40,7 +43,7 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getEmail());
|
||||
$this->assertNotNull($obj->getExternalRememberMeId());
|
||||
$this->assertNotNull($obj->getBuyerAccountNumber());
|
||||
$this->assertNotNull($obj->getAccountNumber());
|
||||
$this->assertNotNull($obj->getSalutation());
|
||||
$this->assertNotNull($obj->getFirstName());
|
||||
$this->assertNotNull($obj->getMiddleName());
|
||||
@@ -67,7 +70,7 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->assertEquals($obj->getEmail(), "TestSample");
|
||||
$this->assertEquals($obj->getExternalRememberMeId(), "TestSample");
|
||||
$this->assertEquals($obj->getBuyerAccountNumber(), "TestSample");
|
||||
$this->assertEquals($obj->getAccountNumber(), "TestSample");
|
||||
$this->assertEquals($obj->getSalutation(), "TestSample");
|
||||
$this->assertEquals($obj->getFirstName(), "TestSample");
|
||||
$this->assertEquals($obj->getMiddleName(), "TestSample");
|
||||
@@ -84,4 +87,5 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getShippingAddress(), ShippingAddressTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class PayerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Payer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"payment_method":"TestSample","status":"TestSample","account_type":"TestSample","account_age":"TestSample","funding_instruments":' .FundingInstrumentTest::getJson() . ',"funding_option_id":"TestSample","funding_option":' .FundingOptionTest::getJson() . ',"related_funding_option":' .FundingOptionTest::getJson() . ',"payer_info":' .PayerInfoTest::getJson() . '}';
|
||||
return '{"payment_method":"TestSample","status":"TestSample","account_type":"TestSample","account_age":"TestSample","funding_instruments":' . FundingInstrumentTest::getJson() . ',"funding_option_id":"TestSample","funding_option":' . FundingOptionTest::getJson() . ',"related_funding_option":' . FundingOptionTest::getJson() . ',"payer_info":' . PayerInfoTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Payer
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class PayerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Payer
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -68,4 +71,5 @@ class PayerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getPayerInfo(), PayerInfoTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class PaymentCardTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object PaymentCard
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"start_month":"TestSample","start_year":"TestSample","cvv2":"TestSample","first_name":"TestSample","last_name":"TestSample","billing_country":"TestSample","billing_address":' .AddressTest::getJson() . ',"external_customer_id":"TestSample","status":"TestSample","valid_until":"TestSample","links":' .LinksTest::getJson() . '}';
|
||||
return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"start_month":"TestSample","start_year":"TestSample","cvv2":"TestSample","first_name":"TestSample","last_name":"TestSample","billing_country":"TestSample","billing_address":' . AddressTest::getJson() . ',"external_customer_id":"TestSample","status":"TestSample","valid_until":"TestSample","issue_number":"TestSample","links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return PaymentCard
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class PaymentCardTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return PaymentCard
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -53,6 +56,7 @@ class PaymentCardTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getExternalCustomerId());
|
||||
$this->assertNotNull($obj->getStatus());
|
||||
$this->assertNotNull($obj->getValidUntil());
|
||||
$this->assertNotNull($obj->getIssueNumber());
|
||||
$this->assertNotNull($obj->getLinks());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
@@ -79,7 +83,9 @@ class PaymentCardTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
|
||||
$this->assertEquals($obj->getStatus(), "TestSample");
|
||||
$this->assertEquals($obj->getValidUntil(), "TestSample");
|
||||
$this->assertEquals($obj->getIssueNumber(), "TestSample");
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class PaymentExecutionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object PaymentExecution
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"payer_id":"TestSample","transactions":[' .TransactionTest::getJson() . ']}';
|
||||
return '{"payer_id":"TestSample","carrier_account_id":"TestSample","transactions":[' . TransactionTest::getJson() . ']}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return PaymentExecution
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class PaymentExecutionTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return PaymentExecution
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -39,6 +42,7 @@ class PaymentExecutionTest extends \PHPUnit_Framework_TestCase
|
||||
$obj = new PaymentExecution(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getPayerId());
|
||||
$this->assertNotNull($obj->getCarrierAccountId());
|
||||
$this->assertNotNull($obj->getTransactions());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
@@ -51,6 +55,9 @@ class PaymentExecutionTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getPayerId(), "TestSample");
|
||||
$this->assertEquals($obj->getCarrierAccountId(), "TestSample");
|
||||
$this->assertEquals($obj->getTransactions(), array(TransactionTest::getObject()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class PaymentHistoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object PaymentHistory
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"payments":' .PaymentTest::getJson() . ',"count":123,"next_id":"TestSample"}';
|
||||
return '{"payments":' . PaymentTest::getJson() . ',"count":123,"next_id":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return PaymentHistory
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class PaymentHistoryTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return PaymentHistory
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -55,4 +58,6 @@ class PaymentHistoryTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getCount(), 123);
|
||||
$this->assertEquals($obj->getNextId(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ class PaymentOptionsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object PaymentOptions
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"allowed_payment_method":"TestSample"}';
|
||||
return '{"allowed_payment_method":"TestSample","recurring_flag":true,"skip_fmf":true}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return PaymentOptions
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class PaymentOptionsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return PaymentOptions
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -39,6 +42,8 @@ class PaymentOptionsTest extends \PHPUnit_Framework_TestCase
|
||||
$obj = new PaymentOptions(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getAllowedPaymentMethod());
|
||||
$this->assertNotNull($obj->getRecurringFlag());
|
||||
$this->assertNotNull($obj->getSkipFmf());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -50,5 +55,9 @@ class PaymentOptionsTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getAllowedPaymentMethod(), "TestSample");
|
||||
$this->assertEquals($obj->getRecurringFlag(), true);
|
||||
$this->assertEquals($obj->getSkipFmf(), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\object;
|
||||
use PayPal\Api\Payment;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
|
||||
/**
|
||||
* Class Payment
|
||||
@@ -15,15 +14,17 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Payment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","intent":"TestSample","payer":' .PayerTest::getJson() . ',"payee":' .PayeeTest::getJson() . ',"cart":"TestSample","transactions":[' .TransactionTest::getJson() . '],"failed_transactions":' .ErrorTest::getJson() . ',"payment_instruction":' .PaymentInstructionTest::getJson() . ',"state":"TestSample","experience_profile_id":"TestSample","redirect_urls":' .RedirectUrlsTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}';
|
||||
return '{"id":"TestSample","intent":"TestSample","payer":' . PayerTest::getJson() . ',"potential_payer_info":' . PotentialPayerInfoTest::getJson() . ',"payee":' . PayeeTest::getJson() . ',"cart":"TestSample","transactions":[' . TransactionTest::getJson() . '],"failed_transactions":' . ErrorTest::getJson() . ',"billing_agreement_tokens":["TestSample"],"credit_financing_offered":' . CreditFinancingOfferedTest::getJson() . ',"payment_instruction":' . PaymentInstructionTest::getJson() . ',"state":"TestSample","experience_profile_id":"TestSample","note_to_payer":"TestSample","redirect_urls":' . RedirectUrlsTest::getJson() . ',"failure_reason":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Payment
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -34,6 +35,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Payment
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -43,14 +45,19 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getId());
|
||||
$this->assertNotNull($obj->getIntent());
|
||||
$this->assertNotNull($obj->getPayer());
|
||||
$this->assertNotNull($obj->getPotentialPayerInfo());
|
||||
$this->assertNotNull($obj->getPayee());
|
||||
$this->assertNotNull($obj->getCart());
|
||||
$this->assertNotNull($obj->getTransactions());
|
||||
$this->assertNotNull($obj->getFailedTransactions());
|
||||
$this->assertNotNull($obj->getBillingAgreementTokens());
|
||||
$this->assertNotNull($obj->getCreditFinancingOffered());
|
||||
$this->assertNotNull($obj->getPaymentInstruction());
|
||||
$this->assertNotNull($obj->getState());
|
||||
$this->assertNotNull($obj->getExperienceProfileId());
|
||||
$this->assertNotNull($obj->getNoteToPayer());
|
||||
$this->assertNotNull($obj->getRedirectUrls());
|
||||
$this->assertNotNull($obj->getFailureReason());
|
||||
$this->assertNotNull($obj->getCreateTime());
|
||||
$this->assertNotNull($obj->getUpdateTime());
|
||||
$this->assertNotNull($obj->getLinks());
|
||||
@@ -67,14 +74,19 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getId(), "TestSample");
|
||||
$this->assertEquals($obj->getIntent(), "TestSample");
|
||||
$this->assertEquals($obj->getPayer(), PayerTest::getObject());
|
||||
$this->assertEquals($obj->getPotentialPayerInfo(), PotentialPayerInfoTest::getObject());
|
||||
$this->assertEquals($obj->getPayee(), PayeeTest::getObject());
|
||||
$this->assertEquals($obj->getCart(), "TestSample");
|
||||
$this->assertEquals($obj->getTransactions(), array(TransactionTest::getObject()));
|
||||
$this->assertEquals($obj->getFailedTransactions(), ErrorTest::getObject());
|
||||
$this->assertEquals($obj->getBillingAgreementTokens(), array("TestSample"));
|
||||
$this->assertEquals($obj->getCreditFinancingOffered(), CreditFinancingOfferedTest::getObject());
|
||||
$this->assertEquals($obj->getPaymentInstruction(), PaymentInstructionTest::getObject());
|
||||
$this->assertEquals($obj->getState(), "TestSample");
|
||||
$this->assertEquals($obj->getExperienceProfileId(), "TestSample");
|
||||
$this->assertEquals($obj->getNoteToPayer(), "TestSample");
|
||||
$this->assertEquals($obj->getRedirectUrls(), RedirectUrlsTest::getObject());
|
||||
$this->assertEquals($obj->getFailureReason(), "TestSample");
|
||||
$this->assertEquals($obj->getCreateTime(), "TestSample");
|
||||
$this->assertEquals($obj->getUpdateTime(), "TestSample");
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
@@ -93,12 +105,13 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->create($mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Payment $obj
|
||||
@@ -112,12 +125,13 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
PaymentTest::getJson()
|
||||
PaymentTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("paymentId", $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Payment $obj
|
||||
@@ -138,6 +152,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
|
||||
$result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Payment $obj
|
||||
@@ -151,13 +166,14 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
self::getJson()
|
||||
));
|
||||
$paymentExecution = PaymentExecutionTest::getObject();
|
||||
|
||||
$result = $obj->execute($paymentExecution, $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Payment $obj
|
||||
@@ -171,7 +187,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
PaymentHistoryTest::getJson()
|
||||
PaymentHistoryTest::getJson()
|
||||
));
|
||||
$params = array();
|
||||
|
||||
@@ -183,8 +199,8 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$obj = self::getObject();
|
||||
$mockApiContext = $this->getMockBuilder('ApiContext')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
return array(
|
||||
array($obj, $mockApiContext),
|
||||
array($obj, null)
|
||||
|
||||
@@ -13,6 +13,7 @@ class PhoneTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Phone
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class PhoneTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Phone
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class PhoneTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Phone
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -56,4 +59,5 @@ class PhoneTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getExtension(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
63
tests/PayPal/Test/Api/PotentialPayerInfoTest.php
Normal file
63
tests/PayPal/Test/Api/PotentialPayerInfoTest.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\PotentialPayerInfo;
|
||||
|
||||
/**
|
||||
* Class PotentialPayerInfo
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class PotentialPayerInfoTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object PotentialPayerInfo
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"email":"TestSample","external_remember_me_id":"TestSample","account_number":"TestSample","billing_address":' .AddressTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return PotentialPayerInfo
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new PotentialPayerInfo(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return PotentialPayerInfo
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new PotentialPayerInfo(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getEmail());
|
||||
$this->assertNotNull($obj->getExternalRememberMeId());
|
||||
$this->assertNotNull($obj->getAccountNumber());
|
||||
$this->assertNotNull($obj->getBillingAddress());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param PotentialPayerInfo $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getEmail(), "TestSample");
|
||||
$this->assertEquals($obj->getExternalRememberMeId(), "TestSample");
|
||||
$this->assertEquals($obj->getAccountNumber(), "TestSample");
|
||||
$this->assertEquals($obj->getBillingAddress(), AddressTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
65
tests/PayPal/Test/Api/PrivateLabelCardTest.php
Normal file
65
tests/PayPal/Test/Api/PrivateLabelCardTest.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\PrivateLabelCard;
|
||||
|
||||
/**
|
||||
* Class PrivateLabelCard
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class PrivateLabelCardTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object PrivateLabelCard
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","card_number":"TestSample","issuer_id":"TestSample","issuer_name":"TestSample","image_key":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return PrivateLabelCard
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new PrivateLabelCard(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return PrivateLabelCard
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new PrivateLabelCard(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getId());
|
||||
$this->assertNotNull($obj->getCardNumber());
|
||||
$this->assertNotNull($obj->getIssuerId());
|
||||
$this->assertNotNull($obj->getIssuerName());
|
||||
$this->assertNotNull($obj->getImageKey());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param PrivateLabelCard $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getId(), "TestSample");
|
||||
$this->assertEquals($obj->getCardNumber(), "TestSample");
|
||||
$this->assertEquals($obj->getIssuerId(), "TestSample");
|
||||
$this->assertEquals($obj->getIssuerName(), "TestSample");
|
||||
$this->assertEquals($obj->getImageKey(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
67
tests/PayPal/Test/Api/ProcessorResponseTest.php
Normal file
67
tests/PayPal/Test/Api/ProcessorResponseTest.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\ProcessorResponse;
|
||||
|
||||
/**
|
||||
* Class ProcessorResponse
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class ProcessorResponseTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object ProcessorResponse
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"response_code":"TestSample","avs_code":"TestSample","cvv_code":"TestSample","advice_code":"TestSample","eci_submitted":"TestSample","vpas":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return ProcessorResponse
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new ProcessorResponse(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return ProcessorResponse
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new ProcessorResponse(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getResponseCode());
|
||||
$this->assertNotNull($obj->getAvsCode());
|
||||
$this->assertNotNull($obj->getCvvCode());
|
||||
$this->assertNotNull($obj->getAdviceCode());
|
||||
$this->assertNotNull($obj->getEciSubmitted());
|
||||
$this->assertNotNull($obj->getVpas());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param ProcessorResponse $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getResponseCode(), "TestSample");
|
||||
$this->assertEquals($obj->getAvsCode(), "TestSample");
|
||||
$this->assertEquals($obj->getCvvCode(), "TestSample");
|
||||
$this->assertEquals($obj->getAdviceCode(), "TestSample");
|
||||
$this->assertEquals($obj->getEciSubmitted(), "TestSample");
|
||||
$this->assertEquals($obj->getVpas(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ class RecipientBankingInstructionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object RecipientBankingInstruction
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class RecipientBankingInstructionTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return RecipientBankingInstruction
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class RecipientBankingInstructionTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return RecipientBankingInstruction
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -61,4 +64,6 @@ class RecipientBankingInstructionTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getInternationalBankAccountNumber(), "TestSample");
|
||||
$this->assertEquals($obj->getBankIdentifierCode(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class RedirectUrlsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object RedirectUrls
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class RedirectUrlsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return RedirectUrls
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class RedirectUrlsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return RedirectUrls
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -53,4 +56,25 @@ class RedirectUrlsTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getReturnUrl(), "http://www.google.com");
|
||||
$this->assertEquals($obj->getCancelUrl(), "http://www.google.com");
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage ReturnUrl is not a fully qualified URL
|
||||
*/
|
||||
public function testUrlValidationForReturnUrl()
|
||||
{
|
||||
$obj = new RedirectUrls();
|
||||
$obj->setReturnUrl(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage CancelUrl is not a fully qualified URL
|
||||
*/
|
||||
public function testUrlValidationForCancelUrl()
|
||||
{
|
||||
$obj = new RedirectUrls();
|
||||
$obj->setCancelUrl(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\Refund;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
|
||||
/**
|
||||
* Class Refund
|
||||
@@ -14,15 +13,17 @@ class RefundTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Refund
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","amount":' .AmountTest::getJson() . ',"state":"TestSample","reason":"TestSample","sale_id":"TestSample","capture_id":"TestSample","parent_payment":"TestSample","description":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}';
|
||||
return '{"id":"TestSample","amount":' . AmountTest::getJson() . ',"state":"TestSample","reason":"TestSample","sale_id":"TestSample","capture_id":"TestSample","parent_payment":"TestSample","description":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Refund
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -33,6 +34,7 @@ class RefundTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Refund
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -86,7 +88,7 @@ class RefundTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
RefundTest::getJson()
|
||||
RefundTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("refundId", $mockApiContext, $mockPPRestCall);
|
||||
@@ -97,8 +99,8 @@ class RefundTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$obj = self::getObject();
|
||||
$mockApiContext = $this->getMockBuilder('ApiContext')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
return array(
|
||||
array($obj, $mockApiContext),
|
||||
array($obj, null)
|
||||
|
||||
@@ -13,15 +13,17 @@ class RelatedResourcesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object RelatedResources
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{}';
|
||||
return '{"sale":' . SaleTest::getJson() . ',"authorization":' . AuthorizationTest::getJson() . ',"order":' . OrderTest::getJson() . ',"capture":' . CaptureTest::getJson() . ',"refund":' . RefundTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return RelatedResources
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,12 +34,18 @@ class RelatedResourcesTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return RelatedResources
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new RelatedResources(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getSale());
|
||||
$this->assertNotNull($obj->getAuthorization());
|
||||
$this->assertNotNull($obj->getOrder());
|
||||
$this->assertNotNull($obj->getCapture());
|
||||
$this->assertNotNull($obj->getRefund());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -48,6 +56,12 @@ class RelatedResourcesTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getSale(), SaleTest::getObject());
|
||||
$this->assertEquals($obj->getAuthorization(), AuthorizationTest::getObject());
|
||||
$this->assertEquals($obj->getOrder(), OrderTest::getObject());
|
||||
$this->assertEquals($obj->getCapture(), CaptureTest::getObject());
|
||||
$this->assertEquals($obj->getRefund(), RefundTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\Sale;
|
||||
use PayPal\Transport\PPRestCall;
|
||||
|
||||
/**
|
||||
* Class Sale
|
||||
@@ -14,15 +13,17 @@ class SaleTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Sale
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","purchase_unit_reference_id":"TestSample","amount":' .AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","clearing_time":"TestSample","recipient_fund_status":"TestSample","hold_reason":"TestSample","transaction_fee":' .CurrencyTest::getJson() . ',"receivable_amount":' .CurrencyTest::getJson() . ',"exchange_rate":"TestSample","fmf_details":' .FmfDetailsTest::getJson() . ',"receipt_id":"TestSample","parent_payment":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}';
|
||||
return '{"id":"TestSample","purchase_unit_reference_id":"TestSample","amount":' . AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","clearing_time":"TestSample","payment_hold_status":"TestSample","payment_hold_reasons":"TestSample","transaction_fee":' . CurrencyTest::getJson() . ',"receivable_amount":' . CurrencyTest::getJson() . ',"exchange_rate":"TestSample","fmf_details":' . FmfDetailsTest::getJson() . ',"receipt_id":"TestSample","parent_payment":"TestSample","processor_response":' . ProcessorResponseTest::getJson() . ',"billing_agreement_id":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Sale
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -33,6 +34,7 @@ class SaleTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Sale
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -48,14 +50,16 @@ class SaleTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getProtectionEligibility());
|
||||
$this->assertNotNull($obj->getProtectionEligibilityType());
|
||||
$this->assertNotNull($obj->getClearingTime());
|
||||
$this->assertNotNull($obj->getRecipientFundStatus());
|
||||
$this->assertNotNull($obj->getHoldReason());
|
||||
$this->assertNotNull($obj->getPaymentHoldStatus());
|
||||
$this->assertNotNull($obj->getPaymentHoldReasons());
|
||||
$this->assertNotNull($obj->getTransactionFee());
|
||||
$this->assertNotNull($obj->getReceivableAmount());
|
||||
$this->assertNotNull($obj->getExchangeRate());
|
||||
$this->assertNotNull($obj->getFmfDetails());
|
||||
$this->assertNotNull($obj->getReceiptId());
|
||||
$this->assertNotNull($obj->getParentPayment());
|
||||
$this->assertNotNull($obj->getProcessorResponse());
|
||||
$this->assertNotNull($obj->getBillingAgreementId());
|
||||
$this->assertNotNull($obj->getCreateTime());
|
||||
$this->assertNotNull($obj->getUpdateTime());
|
||||
$this->assertNotNull($obj->getLinks());
|
||||
@@ -78,14 +82,16 @@ class SaleTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getProtectionEligibility(), "TestSample");
|
||||
$this->assertEquals($obj->getProtectionEligibilityType(), "TestSample");
|
||||
$this->assertEquals($obj->getClearingTime(), "TestSample");
|
||||
$this->assertEquals($obj->getRecipientFundStatus(), "TestSample");
|
||||
$this->assertEquals($obj->getHoldReason(), "TestSample");
|
||||
$this->assertEquals($obj->getPaymentHoldStatus(), "TestSample");
|
||||
$this->assertEquals($obj->getPaymentHoldReasons(), "TestSample");
|
||||
$this->assertEquals($obj->getTransactionFee(), CurrencyTest::getObject());
|
||||
$this->assertEquals($obj->getReceivableAmount(), CurrencyTest::getObject());
|
||||
$this->assertEquals($obj->getExchangeRate(), "TestSample");
|
||||
$this->assertEquals($obj->getFmfDetails(), FmfDetailsTest::getObject());
|
||||
$this->assertEquals($obj->getReceiptId(), "TestSample");
|
||||
$this->assertEquals($obj->getParentPayment(), "TestSample");
|
||||
$this->assertEquals($obj->getProcessorResponse(), ProcessorResponseTest::getObject());
|
||||
$this->assertEquals($obj->getBillingAgreementId(), "TestSample");
|
||||
$this->assertEquals($obj->getCreateTime(), "TestSample");
|
||||
$this->assertEquals($obj->getUpdateTime(), "TestSample");
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
@@ -104,12 +110,13 @@ class SaleTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
SaleTest::getJson()
|
||||
SaleTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("saleId", $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Sale $obj
|
||||
@@ -123,7 +130,7 @@ class SaleTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
RefundTest::getJson()
|
||||
RefundTest::getJson()
|
||||
));
|
||||
$refund = RefundTest::getObject();
|
||||
|
||||
@@ -135,8 +142,8 @@ class SaleTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$obj = self::getObject();
|
||||
$mockApiContext = $this->getMockBuilder('ApiContext')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
return array(
|
||||
array($obj, $mockApiContext),
|
||||
array($obj, null)
|
||||
|
||||
@@ -13,6 +13,7 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object ShippingAddress
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return ShippingAddress
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return ShippingAddress
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -56,4 +59,5 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getDefaultAddress(), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class TransactionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Transaction
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
@@ -22,6 +23,7 @@ class TransactionTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
*
|
||||
* @return Transaction
|
||||
*/
|
||||
public static function getObject()
|
||||
@@ -32,6 +34,7 @@ class TransactionTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
*
|
||||
* @return Transaction
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
@@ -49,4 +52,6 @@ class TransactionTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetters($obj)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ class WebhookEventTest extends \PHPUnit_Framework_TestCase
|
||||
* @dataProvider mockProvider
|
||||
* @param $mockApiContext ApiContext
|
||||
* @expectedException \PHPUnit_Framework_Error_Notice
|
||||
* @expectedExceptionMessage Missing Accessor: PayPal\Api\WebhookEvent:setValid. You might be using older version of SDK. If not, create an issue at https://github.com/paypal/PayPal-PHP-SDK/issues
|
||||
* @expectedExceptionMessage It seems that PayPal\Api\WebhookEvent:setValid is a new field added to the API response. If not, create an issue at https://github.com/paypal/PayPal-PHP-SDK/issues
|
||||
*/
|
||||
public function testValidateWebhookValidJSONWithMissingObject($obj, $mockApiContext)
|
||||
{
|
||||
|
||||
@@ -73,7 +73,6 @@ class PaymentsFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
$result = Payment::get($payment->getId(), $this->apiContext, $this->mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
$this->assertEquals($payment->getId(), $result->getId());
|
||||
$this->assertEquals($payment, $result, "", 0, 10, true);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class Setup
|
||||
'log.LogEnabled' => true,
|
||||
'log.FileName' => '../PayPal.log',
|
||||
'log.LogLevel' => 'FINE',
|
||||
'validation.level' => 'strict'
|
||||
'validation.level' => 'log'
|
||||
);
|
||||
$test->apiContext = new ApiContext(
|
||||
new OAuthTokenCredential('AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS', 'EGnHDxD_qRPdaLdZz8iCr8N7_MzF-YHPTkjs6NKYQvQSBngp4PTTVWkPZRbL')
|
||||
|
||||
@@ -24,7 +24,7 @@ class ModelAccessValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
array(new SimpleClass(), null,'Error'),
|
||||
array(new SimpleClass(), array(),'Error'),
|
||||
array(null, 'name','must be an instance of PayPal\Common\PayPalModel, null given'),
|
||||
array(new SimpleClass(),'notfound', 'Missing Accessor: PayPal\\Test\\Common\\SimpleClass:setnotfound')
|
||||
array(new SimpleClass(),'notfound', 'It seems that PayPal\Test\Common\SimpleClass:setnotfound is a new field added to the API response')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
<?php
|
||||
|
||||
// Include the composer autoloader
|
||||
$loader = require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
// To suppress the warning during the date() invocation in logs, we would default the timezone to GMT.
|
||||
if (!ini_get('date.timezone')) {
|
||||
date_default_timezone_set('GMT');
|
||||
}
|
||||
// Include the composer autoloader
|
||||
$loader = require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
$loader->add('PayPal\\Test', __DIR__);
|
||||
if (!defined("PP_CONFIG_PATH")) {
|
||||
define("PP_CONFIG_PATH", __DIR__);
|
||||
|
||||
Reference in New Issue
Block a user