657e1676c00b9b2a983bc60007d6ac111dc00e1f
[WP-Plugins/glm-member-db-registrations.git] /
1 <?php
2 namespace PayPal\Test\Api;
3
4 use PayPal\Api\Refund;
5 use PayPal\Test\Constants;
6
7 class RefundTest extends \PHPUnit_Framework_TestCase {
8
9         private $refund;
10
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";
15
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);                
24                 
25                 return $refund;
26         }
27         
28         public function setup() {
29                 $this->refund = self::createRefund();
30         }
31
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());
40         }
41         
42         public function testSerializeDeserialize() {
43                 $r1 = $this->refund;
44                 
45                 $r2 = new Refund();
46                 $r2->fromJson($r1->toJson());
47                 
48                 $this->assertEquals($r1, $r2);
49         }
50         
51         public function testOperations() {
52         
53         }
54 }