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/AmountTest.php
2016-10-27 14:05:56 -07:00

59 lines
1.4 KiB
PHP

<?php
namespace PayPal\Test\Api;
use PayPal\Api\Amount;
/**
* Class Amount
*
* @package PayPal\Test\Api
*/
class AmountTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Amount
* @return string
*/
public static function getJson()
{
return '{"currency":"TestSample","total":"12.34","details":' . DetailsTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return Amount
*/
public static function getObject()
{
return new Amount(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Amount
*/
public function testSerializationDeserialization()
{
$obj = new Amount(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCurrency());
$this->assertNotNull($obj->getTotal());
$this->assertNotNull($obj->getDetails());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Amount $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCurrency(), "TestSample");
$this->assertEquals($obj->getTotal(), "12.34");
$this->assertEquals($obj->getDetails(), DetailsTest::getObject());
}
}