/** * @test */ public function shouldDoSubExecuteStartRecurringPaymentApiRequestIfRecurringSet() { $paymentMock = $this->createPaymentMock(); $paymentMock->expects($this->at(1))->method('execute')->with($this->isInstanceOf('Payum\\Payex\\Request\\Api\\StartRecurringPayment')); $action = new PaymentDetailsCaptureAction(); $action->setPayment($paymentMock); $request = new Capture(array('orderRef' => 'aRef', 'recurring' => true)); $action->execute($request); }
/** * @test */ public function shouldDoSubGetHttpRequestAndSetClientIpFromIt() { $gatewayMock = $this->createGatewayMock(); $gatewayMock->expects($this->at(0))->method('execute')->with($this->isInstanceOf('Payum\\Core\\Request\\GetHttpRequest'))->will($this->returnCallback(function (GetHttpRequest $request) { $request->clientIp = 'expectedClientIp'; })); $action = new PaymentDetailsCaptureAction(); $action->setGateway($gatewayMock); $request = new Capture(array()); $action->execute($request); $details = iterator_to_array($request->getModel()); $this->assertArrayHasKey('clientIPAddress', $details); $this->assertEquals('expectedClientIp', $details['clientIPAddress']); }