@@ -105,6 +105,45 @@ protected function setUp()
105
105
);
106
106
}
107
107
108
+ public function testFetchTransactionInfo ()
109
+ {
110
+ $ transactionId = 10555 ;
111
+ $ transactionInfo = ['test_key ' => 'test_value ' ];
112
+
113
+ $ valueHandler = $ this ->getMockForAbstractClass (ValueHandlerInterface::class);
114
+ $ command = $ this ->getMockForAbstractClass (CommandInterface::class);
115
+
116
+ /** @var InfoInterface|MockObject $paymentInfo */
117
+ $ paymentInfo = $ this ->getMockForAbstractClass (InfoInterface::class);
118
+ $ paymentDO = $ this ->getMockForAbstractClass (PaymentDataObjectInterface::class);
119
+
120
+ $ this ->valueHandlerPool ->method ('get ' )
121
+ ->with ('can_fetch_transaction_information ' )
122
+ ->willReturn ($ valueHandler );
123
+ $ valueHandler ->expects ($ this ->atLeastOnce ())
124
+ ->method ('handle ' )
125
+ ->with (['field ' => 'can_fetch_transaction_information ' ])
126
+ ->willReturn (true );
127
+
128
+ $ this ->paymentDataObjectFactory ->method ('create ' )
129
+ ->with ($ paymentInfo )
130
+ ->willReturn ($ paymentDO );
131
+
132
+ $ this ->commandPool ->method ('get ' )
133
+ ->with ('fetch_transaction_information ' )
134
+ ->willReturn ($ command );
135
+ $ command ->expects ($ this ->atLeastOnce ())
136
+ ->method ('execute ' )
137
+ ->with (['transactionId ' => $ transactionId , 'payment ' => $ paymentDO ])
138
+ ->willReturn ($ transactionInfo );
139
+
140
+ $ this ->assertEquals (
141
+ $ transactionInfo ,
142
+ $ this ->adapter ->fetchTransactionInfo ($ paymentInfo , $ transactionId )
143
+ );
144
+
145
+ }
146
+
108
147
/**
109
148
* @covers \Magento\Payment\Model\Method\Adapter::isAvailable
110
149
*/
0 commit comments