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:
@@ -7,52 +7,57 @@ use PayPal\Api\SubTransaction;
|
||||
use PayPal\Api\Transaction;
|
||||
use PayPal\Test\Constants;
|
||||
|
||||
class TransactionTest extends \PHPUnit_Framework_TestCase {
|
||||
class TransactionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $transaction;
|
||||
private $transaction;
|
||||
|
||||
public static $description = "desc . . . ";
|
||||
public static $invoiceNumber = "#123";
|
||||
public static $custom = "custom";
|
||||
public static $softDescriptor = "descriptor";
|
||||
public static $total = "1.12";
|
||||
public static $description = "desc . . . ";
|
||||
public static $invoiceNumber = "#123";
|
||||
public static $custom = "custom";
|
||||
public static $softDescriptor = "descriptor";
|
||||
public static $total = "1.12";
|
||||
|
||||
public static function createTransaction() {
|
||||
$transaction = new Transaction();
|
||||
$transaction->setAmount(AmountTest::createAmount());
|
||||
$transaction->setDescription(self::$description);
|
||||
$transaction->setInvoiceNumber(self::$invoiceNumber);
|
||||
$transaction->setCustom(self::$custom);
|
||||
$transaction->setSoftDescriptor(self::$softDescriptor);
|
||||
$transaction->setItemList(ItemListTest::createItemList());
|
||||
$transaction->setPayee(PayeeTest::createPayee());
|
||||
$transaction->setRelatedResources( array(RelatedResourcesTest::createRelatedResources()) );
|
||||
return $transaction;
|
||||
}
|
||||
|
||||
public function setup() {
|
||||
$this->transaction = self::createTransaction();
|
||||
}
|
||||
public static function createTransaction()
|
||||
{
|
||||
$transaction = new Transaction();
|
||||
$transaction->setAmount(AmountTest::createAmount());
|
||||
$transaction->setDescription(self::$description);
|
||||
$transaction->setInvoiceNumber(self::$invoiceNumber);
|
||||
$transaction->setCustom(self::$custom);
|
||||
$transaction->setSoftDescriptor(self::$softDescriptor);
|
||||
$transaction->setItemList(ItemListTest::createItemList());
|
||||
$transaction->setPayee(PayeeTest::createPayee());
|
||||
$transaction->setRelatedResources(array(RelatedResourcesTest::createRelatedResources()));
|
||||
return $transaction;
|
||||
}
|
||||
|
||||
public function testGetterSetter() {
|
||||
$this->assertEquals(AmountTest::$currency, $this->transaction->getAmount()->getCurrency());
|
||||
$this->assertEquals(self::$description, $this->transaction->getDescription());
|
||||
$this->assertEquals(self::$invoiceNumber, $this->transaction->getInvoiceNumber());
|
||||
$this->assertEquals(self::$custom, $this->transaction->getCustom());
|
||||
$this->assertEquals(self::$softDescriptor, $this->transaction->getSoftDescriptor());
|
||||
$items = $this->transaction->getItemList()->getItems();
|
||||
$this->assertEquals(ItemTest::$quantity, $items[0]->getQuantity());
|
||||
$this->assertEquals(PayeeTest::$email, $this->transaction->getPayee()->getEmail());
|
||||
$resources = $this->transaction->getRelatedResources();
|
||||
$this->assertEquals(AuthorizationTest::$create_time, $resources[0]->getAuthorization()->getCreateTime());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize() {
|
||||
$t1 = $this->transaction;
|
||||
|
||||
$t2 = new Transaction();
|
||||
$t2->fromJson($t1->toJson());
|
||||
|
||||
$this->assertEquals($t1, $t2);
|
||||
}
|
||||
public function setup()
|
||||
{
|
||||
$this->transaction = self::createTransaction();
|
||||
}
|
||||
|
||||
public function testGetterSetter()
|
||||
{
|
||||
$this->assertEquals(AmountTest::$currency, $this->transaction->getAmount()->getCurrency());
|
||||
$this->assertEquals(self::$description, $this->transaction->getDescription());
|
||||
$this->assertEquals(self::$invoiceNumber, $this->transaction->getInvoiceNumber());
|
||||
$this->assertEquals(self::$custom, $this->transaction->getCustom());
|
||||
$this->assertEquals(self::$softDescriptor, $this->transaction->getSoftDescriptor());
|
||||
$items = $this->transaction->getItemList()->getItems();
|
||||
$this->assertEquals(ItemTest::$quantity, $items[0]->getQuantity());
|
||||
$this->assertEquals(PayeeTest::$email, $this->transaction->getPayee()->getEmail());
|
||||
$resources = $this->transaction->getRelatedResources();
|
||||
$this->assertEquals(AuthorizationTest::$create_time, $resources[0]->getAuthorization()->getCreateTime());
|
||||
}
|
||||
|
||||
public function testSerializeDeserialize()
|
||||
{
|
||||
$t1 = $this->transaction;
|
||||
|
||||
$t2 = new Transaction();
|
||||
$t2->fromJson($t1->toJson());
|
||||
|
||||
$this->assertEquals($t1, $t2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user