@@ -235,7 +235,7 @@ private function getPaymentConfigInterfaceFactory()
235235 ->disableOriginalConstructor ()
236236 ->getMock ();
237237 $ this ->paymentConfig = $ this ->getMockBuilder (PaymentConfigInterface::class)
238- ->setMethods (['setStoreId ' , 'setMethodInstance ' , 'setMethod ' , 'getBuildNotationCode ' ])
238+ ->addMethods (['setStoreId ' , 'setMethodInstance ' , 'setMethod ' , 'getBuildNotationCode ' , ' getPaymentAction ' ])
239239 ->getMockForAbstractClass ();
240240
241241 $ paymentConfigInterfaceFactory ->method ('create ' )->willReturn ($ this ->paymentConfig );
@@ -345,6 +345,23 @@ private function initPayment()
345345 {
346346 $ this ->payment = $ this ->getMockBuilder (Payment::class)
347347 ->disableOriginalConstructor ()
348+ ->addMethods (['getIsTransactionApproved ' ])
349+ ->onlyMethods (
350+ [
351+ 'setTransactionId ' ,
352+ 'setIsTransactionClosed ' ,
353+ 'getCcExpYear ' ,
354+ 'getCcExpMonth ' ,
355+ 'getExtensionAttributes ' ,
356+ 'getOrder ' ,
357+ 'authorize ' ,
358+ 'canFetchTransactionInfo ' ,
359+ 'getParentTransactionId ' ,
360+ 'setParentTransactionId ' ,
361+ 'setAdditionalInformation ' ,
362+ 'getAdditionalInformation '
363+ ]
364+ )
348365 ->getMock ();
349366 $ this ->order = $ this ->getMockBuilder (Order::class)
350367 ->disableOriginalConstructor ()
@@ -360,7 +377,16 @@ private function initPayment()
360377 $ this ->payment ->method ('getCcExpYear ' )->willReturn ('2019 ' );
361378 $ this ->payment ->method ('getCcExpMonth ' )->willReturn ('05 ' );
362379 $ this ->payment ->method ('getExtensionAttributes ' )->willReturn ($ this ->paymentExtensionAttributes );
380+ $ this ->payment ->method ('getIsTransactionApproved ' )->willReturn (true );
363381
364382 return $ this ->payment ;
365383 }
384+
385+ public function testFetchTransactionInfo ()
386+ {
387+ $ this ->payment ->method ('canFetchTransactionInfo ' )->willReturn (false );
388+ $ this ->paymentConfig ->method ('getPaymentAction ' )->willReturn ('authorize ' );
389+ $ this ->payment ->expects ($ this ->never ())->method ('authorize ' );
390+ $ this ->subject ->fetchTransactionInfo ($ this ->payment , '123 ' );
391+ }
366392}
0 commit comments