public function testAuthorizeTransactionPending()
 {
     $storeID = 1;
     $amount = 10;
     $baseCurrencyMock = $this->getMockBuilder('Magento\\Directory\\Model\\Currency')->disableOriginalConstructor()->setMethods(['formatTxt'])->getMock();
     $baseCurrencyMock->expects($this->once())->method('formatTxt')->willReturnCallback(function ($value) {
         return $value;
     });
     $this->orderMock->expects($this->once())->method('getStoreId')->willReturn($storeID);
     $this->orderMock->expects($this->once())->method('getBaseGrandTotal')->willReturn($amount);
     $this->orderMock->expects($this->once())->method('getBaseCurrency')->willReturn($baseCurrencyMock);
     $this->orderMock->expects($this->once())->method('setState')->with(\Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW, true, "We will authorize {$amount} after the payment is approved at the payment gateway.");
     $this->paymentMethodMock->expects($this->once())->method('authorize')->with($this->payment)->willReturnSelf();
     $this->payment->setIsTransactionPending(true);
     $paymentResult = $this->payment->authorize(true, $amount);
     $this->assertInstanceOf('Magento\\Sales\\Model\\Order\\Payment', $paymentResult);
     $this->assertEquals($amount, $paymentResult->getBaseAmountAuthorized());
     $this->assertTrue($paymentResult->getIsTransactionPending());
 }
 /**
  * {@inheritdoc}
  */
 public function setIsTransactionPending($flag)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setIsTransactionPending');
     if (!$pluginInfo) {
         return parent::setIsTransactionPending($flag);
     } else {
         return $this->___callPlugins('setIsTransactionPending', func_get_args(), $pluginInfo);
     }
 }