assertNotNull($obj); $this->assertNotNull($obj->getId()); $this->assertNotNull($obj->getPurchaseUnitReferenceId()); $this->assertNotNull($obj->getAmount()); $this->assertNotNull($obj->getPaymentMode()); $this->assertNotNull($obj->getState()); $this->assertNotNull($obj->getReasonCode()); $this->assertNotNull($obj->getProtectionEligibility()); $this->assertNotNull($obj->getProtectionEligibilityType()); $this->assertNotNull($obj->getClearingTime()); $this->assertNotNull($obj->getPaymentHoldStatus()); $this->assertNotNull($obj->getPaymentHoldReasons()); $this->assertNotNull($obj->getTransactionFee()); $this->assertNotNull($obj->getReceivableAmount()); $this->assertNotNull($obj->getExchangeRate()); $this->assertNotNull($obj->getFmfDetails()); $this->assertNotNull($obj->getReceiptId()); $this->assertNotNull($obj->getParentPayment()); $this->assertNotNull($obj->getProcessorResponse()); $this->assertNotNull($obj->getBillingAgreementId()); $this->assertNotNull($obj->getCreateTime()); $this->assertNotNull($obj->getUpdateTime()); $this->assertNotNull($obj->getLinks()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; } /** * @depends testSerializationDeserialization * @param Sale $obj */ public function testGetters($obj) { $this->assertEquals($obj->getId(), "TestSample"); $this->assertEquals($obj->getPurchaseUnitReferenceId(), "TestSample"); $this->assertEquals($obj->getAmount(), AmountTest::getObject()); $this->assertEquals($obj->getPaymentMode(), "TestSample"); $this->assertEquals($obj->getState(), "TestSample"); $this->assertEquals($obj->getReasonCode(), "TestSample"); $this->assertEquals($obj->getProtectionEligibility(), "TestSample"); $this->assertEquals($obj->getProtectionEligibilityType(), "TestSample"); $this->assertEquals($obj->getClearingTime(), "TestSample"); $this->assertEquals($obj->getPaymentHoldStatus(), "TestSample"); $this->assertEquals($obj->getPaymentHoldReasons(), "TestSample"); $this->assertEquals($obj->getTransactionFee(), CurrencyTest::getObject()); $this->assertEquals($obj->getReceivableAmount(), CurrencyTest::getObject()); $this->assertEquals($obj->getExchangeRate(), "TestSample"); $this->assertEquals($obj->getFmfDetails(), FmfDetailsTest::getObject()); $this->assertEquals($obj->getReceiptId(), "TestSample"); $this->assertEquals($obj->getParentPayment(), "TestSample"); $this->assertEquals($obj->getProcessorResponse(), ProcessorResponseTest::getObject()); $this->assertEquals($obj->getBillingAgreementId(), "TestSample"); $this->assertEquals($obj->getCreateTime(), "TestSample"); $this->assertEquals($obj->getUpdateTime(), "TestSample"); $this->assertEquals($obj->getLinks(), LinksTest::getObject()); } /** * @dataProvider mockProvider * @param Sale $obj */ public function testGet($obj, $mockApiContext) { $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') ->disableOriginalConstructor() ->getMock(); $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( SaleTest::getJson() )); $result = $obj->get("saleId", $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } /** * @dataProvider mockProvider * @param Sale $obj */ public function testRefund($obj, $mockApiContext) { $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') ->disableOriginalConstructor() ->getMock(); $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( RefundTest::getJson() )); $refund = RefundTest::getObject(); $result = $obj->refund($refund, $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } public function mockProvider() { $obj = self::getObject(); $mockApiContext = $this->getMockBuilder('ApiContext') ->disableOriginalConstructor() ->getMock(); return array( array($obj, $mockApiContext), array($obj, null) ); } }