This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/tests/PayPal/Test/Api/InstallmentOptionTest.php
Jay Patel 8c907803e3 [PSR] Fixed Samples
- Using `php-cs-fixer` tool.
2016-07-14 13:12:15 -05:00

64 lines
1.7 KiB
PHP

<?php
namespace PayPal\Test\Api;
use PayPal\Api\InstallmentOption;
/**
* Class InstallmentOption
*
* @package PayPal\Test\Api
*/
class InstallmentOptionTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object InstallmentOption
*
* @return string
*/
public static function getJson()
{
return '{"term":123,"monthly_payment":' . CurrencyTest::getJson() . ',"discount_amount":' . CurrencyTest::getJson() . ',"discount_percentage":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return InstallmentOption
*/
public static function getObject()
{
return new InstallmentOption(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
*
* @return InstallmentOption
*/
public function testSerializationDeserialization()
{
$obj = new InstallmentOption(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getTerm());
$this->assertNotNull($obj->getMonthlyPayment());
$this->assertNotNull($obj->getDiscountAmount());
$this->assertNotNull($obj->getDiscountPercentage());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param InstallmentOption $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getTerm(), 123);
$this->assertEquals($obj->getMonthlyPayment(), CurrencyTest::getObject());
$this->assertEquals($obj->getDiscountAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getDiscountPercentage(), "TestSample");
}
}