/**
  * @test
  */
 public function shouldRequestGetTransactionDetailsTwice()
 {
     $gatewayMock = $this->createGatewayMock();
     $gatewayMock->expects($this->at(1))->method('execute')->with($this->isInstanceOf('Payum\\Paypal\\ExpressCheckout\\Nvp\\Request\\Api\\GetTransactionDetails'))->will($this->returnCallback(function (GetTransactionDetails $request) {
         $model = $request->getModel();
         $model['foo'] = 'fooVal';
     }));
     $gatewayMock->expects($this->at(2))->method('execute')->with($this->isInstanceOf('Payum\\Paypal\\ExpressCheckout\\Nvp\\Request\\Api\\GetTransactionDetails'))->will($this->returnCallback(function (GetTransactionDetails $request) {
         $model = $request->getModel();
         $model['bar'] = 'barVal';
     }));
     $action = new PaymentDetailsSyncAction();
     $action->setGateway($gatewayMock);
     $details = new \ArrayObject(array('PAYMENTREQUEST_0_AMT' => 12, 'TOKEN' => 'aToken', 'PAYMENTREQUEST_0_TRANSACTIONID' => 'zeroTransId', 'PAYMENTREQUEST_9_TRANSACTIONID' => 'nineTransId'));
     $action->execute(new Sync($details));
     $this->assertArrayHasKey('foo', (array) $details);
     $this->assertEquals('fooVal', $details['foo']);
     $this->assertArrayHasKey('bar', (array) $details);
     $this->assertEquals('barVal', $details['bar']);
 }