Inheritance: extends PHPUnit_Framework_TestCase
Ejemplo n.º 1
0
 public static function createPaymentHistory()
 {
     $history = new PaymentHistory();
     $history->setCount(self::$count);
     $history->setNext_id(self::$nextId);
     $history->setPayments(array(PaymentTest::createPayment()));
     return $history;
 }
Ejemplo n.º 2
0
 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");
 }
Ejemplo n.º 4
0
 /**
  * @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);
 }