public static function createPaymentHistory() { $history = new PaymentHistory(); $history->setCount(self::$count); $history->setNext_id(self::$nextId); $history->setPayments(array(PaymentTest::createPayment())); return $history; }
public function testOperations() { $payment = PaymentTest::createNewPayment(); $payment->create(); $transactions = $payment->getTransactions(); $resources = $transactions[0]->getRelated_resources(); $saleId = $resources[0]->getSale()->getId(); $sale = Sale::get($saleId); $this->assertNotNull($sale); $refund = new Refund(); $refund->setAmount(AmountTest::createAmount()); $sale->refund($refund); $this->setExpectedException('\\InvalidArgumentException'); $sale->refund(NULL); }
/** * @depends testSerializationDeserialization * @param PaymentHistory $obj */ public function testGetters($obj) { $this->assertEquals($obj->getPayments(), PaymentTest::getObject()); $this->assertEquals($obj->getCount(), 123); $this->assertEquals($obj->getNextId(), "TestSample"); }
/** * @dataProvider mockProvider * @param Payment $obj */ public function testGet($obj, $mockApiContext) { $mockPPRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock(); $mockPPRestCall->expects($this->any())->method('execute')->will($this->returnValue(PaymentTest::getJson())); $result = $obj->get("paymentId", $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); }