/** * @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']); }