8
8
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
9
9
use Magento \Payment \Gateway \Command \CommandManagerInterface ;
10
10
use Magento \Payment \Gateway \Command \CommandManagerPoolInterface ;
11
+ use Magento \Payment \Gateway \Config \ValueHandlerInterface ;
12
+ use Magento \Payment \Gateway \Config \ValueHandlerPoolInterface ;
11
13
use Magento \Payment \Gateway \ConfigInterface ;
12
14
use Magento \Payment \Model \InfoInterface ;
13
15
use Magento \Payment \Model \MethodInterface ;
@@ -314,11 +316,17 @@ public function testIsAvailableWithoutQuote()
314
316
*/
315
317
public function testCanUseInternal ($ configValue , $ paymentValue , $ expected )
316
318
{
317
- $ config = $ this ->getMock (ConfigInterface::class);
319
+ $ handlerPool = $ this ->getMock (ValueHandlerPoolInterface::class);
320
+ $ handler = $ this ->getMock (ValueHandlerInterface::class);
318
321
319
- $ config ->expects (static ::once ())
320
- ->method ('getValue ' )
321
- ->with ('can_use_internal ' , null )
322
+ $ handlerPool ->expects (static ::once ())
323
+ ->method ('get ' )
324
+ ->with ('can_use_internal ' )
325
+ ->willReturn ($ handler );
326
+
327
+ $ handler ->expects (static ::once ())
328
+ ->method ('handle ' )
329
+ ->with (['field ' => 'can_use_internal ' ], null )
322
330
->willReturn ($ configValue );
323
331
324
332
$ this ->vaultProvider ->expects (static ::any ())
@@ -327,8 +335,8 @@ public function testCanUseInternal($configValue, $paymentValue, $expected)
327
335
328
336
/** @var Vault $model */
329
337
$ model = $ this ->objectManager ->getObject (Vault::class, [
330
- 'config ' => $ config ,
331
- 'vaultProvider ' => $ this -> vaultProvider
338
+ 'vaultProvider ' => $ this -> vaultProvider ,
339
+ 'valueHandlerPool ' => $ handlerPool ,
332
340
]);
333
341
static ::assertEquals ($ expected , $ model ->canUseInternal ());
334
342
}
@@ -343,7 +351,7 @@ public function internalUsageDataProvider()
343
351
['configValue ' => true , 'paymentValue ' => true , 'expected ' => true ],
344
352
['configValue ' => true , 'paymentValue ' => null , 'expected ' => true ],
345
353
['configValue ' => true , 'paymentValue ' => false , 'expected ' => true ],
346
- ['configValue ' => false , 'paymentValue ' => true , 'expected ' => true ],
354
+ ['configValue ' => false , 'paymentValue ' => true , 'expected ' => false ],
347
355
['configValue ' => false , 'paymentValue ' => false , 'expected ' => false ],
348
356
['configValue ' => null , 'paymentValue ' => true , 'expected ' => true ],
349
357
['configValue ' => null , 'paymentValue ' => false , 'expected ' => false ],
0 commit comments