@@ -235,7 +235,7 @@ private function getPaymentConfigInterfaceFactory()
235
235
->disableOriginalConstructor ()
236
236
->getMock ();
237
237
$ this ->paymentConfig = $ this ->getMockBuilder (PaymentConfigInterface::class)
238
- ->setMethods (['setStoreId ' , 'setMethodInstance ' , 'setMethod ' , 'getBuildNotationCode ' ])
238
+ ->addMethods (['setStoreId ' , 'setMethodInstance ' , 'setMethod ' , 'getBuildNotationCode ' , ' getPaymentAction ' ])
239
239
->getMockForAbstractClass ();
240
240
241
241
$ paymentConfigInterfaceFactory ->method ('create ' )->willReturn ($ this ->paymentConfig );
@@ -345,6 +345,23 @@ private function initPayment()
345
345
{
346
346
$ this ->payment = $ this ->getMockBuilder (Payment::class)
347
347
->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
+ )
348
365
->getMock ();
349
366
$ this ->order = $ this ->getMockBuilder (Order::class)
350
367
->disableOriginalConstructor ()
@@ -360,7 +377,16 @@ private function initPayment()
360
377
$ this ->payment ->method ('getCcExpYear ' )->willReturn ('2019 ' );
361
378
$ this ->payment ->method ('getCcExpMonth ' )->willReturn ('05 ' );
362
379
$ this ->payment ->method ('getExtensionAttributes ' )->willReturn ($ this ->paymentExtensionAttributes );
380
+ $ this ->payment ->method ('getIsTransactionApproved ' )->willReturn (true );
363
381
364
382
return $ this ->payment ;
365
383
}
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
+ }
366
392
}
0 commit comments