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
Ganesh Hegde 50b09bdbde testcases updated
updated testcases to match new json schema
and updates with camel case function names
2013-05-28 10:08:34 +05:30

45 lines
1.1 KiB
PHP

<?php
namespace PayPal\Test\Api;
use PayPal\Api\Amount;
use PayPal\Test\Constants;
class AmountTest extends \PHPUnit_Framework_TestCase {
private $amounts;
public static $currency = "USD";
public static $total = "1.12";
public static function createAmount() {
$amount = new Amount();
$amount->setCurrency(self::$currency);
$amount->setTotal(self::$total);
return $amount;
}
public function setup() {
$this->amounts['partial'] = self::createAmount();
$amount = self::createAmount();
$amount->setDetails(DetailsTest::createAmountDetails());
$this->amounts['full'] = $amount;
}
public function testGetterSetter() {
$this->assertEquals(self::$currency, $this->amounts['partial']->getCurrency());
$this->assertEquals(self::$total, $this->amounts['partial']->getTotal());
$this->assertEquals(DetailsTest::$fee, $this->amounts['full']->getDetails()->getFee());
}
public function testSerializeDeserialize() {
$a1 = $this->amounts['partial'];
$a2 = new Amount();
$a2->fromJson($a1->toJson());
$this->assertEquals($a1, $a2);
}
}