public function capture($capture, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($capture, 'capture'); $payLoad = $capture->toJSON(); $json = self::executeCall("/v1/payments/orders/{$this->getId()}/capture", "POST", $payLoad, null, $apiContext, $restCall); $ret = new Capture(); $ret->fromJson($json); return $ret; }
/** * @dataProvider mockProvider * @param Order $obj */ public function testCapture($obj, $mockApiContext) { $mockPPRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock(); $mockPPRestCall->expects($this->any())->method('execute')->will($this->returnValue(CaptureTest::getJson())); $capture = CaptureTest::getObject(); $result = $obj->capture($capture, $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); }