forked from LiveCarta/PayPal-PHP-SDK
Enabled EC Parameters support
- Updated Api to enabled EC Parameters - Updated Tests - Updated Logging Manager - Added a feature to do validation on accessors.
This commit is contained in:
@@ -5,41 +5,46 @@ namespace PayPal\Test\Api;
|
||||
use PayPal\Api\Amount;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class AmountTest extends \PHPUnit_Framework_TestCase {
|
||||
class AmountTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $amounts;
|
||||
private $amounts;
|
||||
|
||||
public static $currency = "USD";
|
||||
public static $total = "1.12";
|
||||
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 static function createAmount()
|
||||
{
|
||||
$amount = new Amount();
|
||||
$amount->setCurrency(self::$currency);
|
||||
$amount->setTotal(self::$total);
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user