6
6
7
7
namespace Magento \Payment \Test \Unit \Model ;
8
8
9
- use Magento \Payment \Model \MethodList ;
10
9
use Magento \Payment \Model \Method \AbstractMethod ;
10
+ use Magento \Payment \Model \MethodList ;
11
11
12
12
class MethodListTest extends \PHPUnit \Framework \TestCase
13
13
{
@@ -36,6 +36,11 @@ class MethodListTest extends \PHPUnit\Framework\TestCase
36
36
*/
37
37
protected $ specificationFactoryMock ;
38
38
39
+ /**
40
+ * @var array $additionalChecks
41
+ */
42
+ private $ additionalChecks ;
43
+
39
44
protected function setUp ()
40
45
{
41
46
$ this ->objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
@@ -49,10 +54,14 @@ protected function setUp()
49
54
)->disableOriginalConstructor ()->getMock ();
50
55
51
56
$ this ->specificationFactoryMock = $ this ->createMock (\Magento \Payment \Model \Checks \SpecificationFactory::class);
57
+
58
+ $ this ->additionalChecks = ['acme_custom_payment_method_check ' => 'acme_custom_payment_method_check ' ];
59
+
52
60
$ this ->methodList = $ this ->objectManager ->getObject (
53
61
\Magento \Payment \Model \MethodList::class,
54
62
[
55
- 'specificationFactory ' => $ this ->specificationFactoryMock
63
+ 'specificationFactory ' => $ this ->specificationFactoryMock ,
64
+ 'additionalChecks ' => $ this ->additionalChecks
56
65
]
57
66
);
58
67
@@ -68,6 +77,9 @@ protected function setUp()
68
77
);
69
78
}
70
79
80
+ /**
81
+ * Verify available payment methods
82
+ */
71
83
public function testGetAvailableMethods ()
72
84
{
73
85
$ storeId = 1 ;
@@ -90,13 +102,17 @@ public function testGetAvailableMethods()
90
102
91
103
$ this ->specificationFactoryMock ->expects ($ this ->atLeastOnce ())
92
104
->method ('create ' )
93
- ->with ([
94
- AbstractMethod::CHECK_USE_CHECKOUT ,
95
- AbstractMethod::CHECK_USE_FOR_COUNTRY ,
96
- AbstractMethod::CHECK_USE_FOR_CURRENCY ,
97
- AbstractMethod::CHECK_ORDER_TOTAL_MIN_MAX
98
- ])
99
- ->will ($ this ->returnValue ($ compositeMock ));
105
+ ->with (
106
+ array_merge (
107
+ [
108
+ AbstractMethod::CHECK_USE_CHECKOUT ,
109
+ AbstractMethod::CHECK_USE_FOR_COUNTRY ,
110
+ AbstractMethod::CHECK_USE_FOR_CURRENCY ,
111
+ AbstractMethod::CHECK_ORDER_TOTAL_MIN_MAX
112
+ ],
113
+ $ this ->additionalChecks
114
+ )
115
+ )->will ($ this ->returnValue ($ compositeMock ));
100
116
101
117
$ methodMock = $ this ->getMockForAbstractClass (\Magento \Payment \Api \Data \PaymentMethodInterface::class);
102
118
$ this ->paymentMethodList ->expects ($ this ->once ())
0 commit comments