2 namespace PayPal\Test\Api;
 
   5 use PayPal\Test\Constants;
 
   7 class RefundTest extends \PHPUnit_Framework_TestCase {
 
  11         public static $captureId = "CAP-123";
 
  12         public static $createTime = "2013-02-28T00:00:00Z";
 
  13         public static $id = "R-5678";
 
  14         public static $parentPayment = "PAY-123";
 
  16         public static function createRefund() {
 
  17                 $refund = new Refund();
 
  18         $refund->setCreateTime(self::$createTime);
 
  19                 $refund->setAmount(AmountTest::createAmount());
 
  20                 $refund->setCaptureId(self::$captureId);
 
  21                 $refund->setId(self::$id);
 
  22                 $refund->setLinks(array(LinksTest::createLinks()));
 
  23                 $refund->setParentPayment(self::$parentPayment);                
 
  28         public function setup() {
 
  29                 $this->refund = self::createRefund();
 
  32         public function testGetterSetter() {
 
  33                 $this->assertEquals(self::$captureId, $this->refund->getCaptureId());
 
  34                 $this->assertEquals(self::$createTime, $this->refund->getCreateTime());
 
  35                 $this->assertEquals(self::$id, $this->refund->getId());
 
  36                 $this->assertEquals(self::$parentPayment, $this->refund->getParentPayment());           
 
  37                 $this->assertEquals(AmountTest::$currency, $this->refund->getAmount()->getCurrency());
 
  38                 $links = $this->refund->getLinks();
 
  39                 $this->assertEquals(LinksTest::$href, $links[0]->getHref());
 
  42         public function testSerializeDeserialize() {
 
  46                 $r2->fromJson($r1->toJson());
 
  48                 $this->assertEquals($r1, $r2);
 
  51         public function testOperations() {