18
18
use Magento \Payment \Model \Method \Free ;
19
19
use Magento \Payment \Model \Method \Logger ;
20
20
use Magento \Quote \Model \Quote ;
21
- use Magento \Sales \Model \Order \Config ;
22
21
use PHPUnit \Framework \MockObject \MockObject ;
23
22
use PHPUnit \Framework \TestCase ;
24
23
use Psr \Log \LoggerInterface ;
@@ -43,11 +42,6 @@ class FreeTest extends TestCase
43
42
*/
44
43
protected $ currencyPrice ;
45
44
46
- /**
47
- * @var MockObject
48
- */
49
- protected $ configMock ;
50
-
51
45
/**
52
46
* @inheritdoc
53
47
*/
@@ -70,8 +64,6 @@ protected function setUp(): void
70
64
->setConstructorArgs ([$ this ->getMockForAbstractClass (LoggerInterface::class)])
71
65
->getMock ();
72
66
73
- $ this ->configMock = $ this ->createMock (Config::class);
74
-
75
67
$ this ->methodFree = new Free (
76
68
$ context ,
77
69
$ registry ,
@@ -80,33 +72,26 @@ protected function setUp(): void
80
72
$ paymentData ,
81
73
$ this ->scopeConfig ,
82
74
$ loggerMock ,
83
- $ this ->currencyPrice ,
84
- null ,
85
- null ,
86
- [],
87
- $ this ->configMock
75
+ $ this ->currencyPrice
88
76
);
89
77
}
90
78
91
79
/**
92
80
* @param string $orderStatus
93
81
* @param string $paymentAction
94
82
* @param mixed $result
95
- * @param array $stateStatuses
96
83
*
97
84
* @return void
98
85
* @dataProvider getConfigPaymentActionProvider
99
86
*/
100
87
public function testGetConfigPaymentAction ($ orderStatus , $ paymentAction , $ result , $ stateStatuses ): void
101
88
{
102
- $ this ->configMock
103
- ->method ('getStateStatuses ' )
104
- ->with ('new ' )
105
- ->willReturn ($ stateStatuses );
106
- $ this ->scopeConfig
107
- ->method ('getValue ' )
108
- ->withConsecutive (['payment/free/order_status ' ], ['payment/free/ ' .$ paymentAction ])
109
- ->willReturnOnConsecutiveCalls ($ orderStatus , $ result );
89
+
90
+ if ($ orderStatus != 'pending ' ) {
91
+ $ this ->scopeConfig
92
+ ->method ('getValue ' )
93
+ ->willReturnOnConsecutiveCalls ($ orderStatus , $ result );
94
+ }
110
95
$ this ->assertEquals ($ result , $ this ->methodFree ->getConfigPaymentAction ());
111
96
}
112
97
@@ -165,12 +150,10 @@ public function getIsAvailableProvider(): array
165
150
public function getConfigPaymentActionProvider (): array
166
151
{
167
152
return [
168
- ['pending ' , 'payment_action ' , null , ['pending ' => 'Pending ' ]],
169
- ['new ' , 'payment_action ' , null , ['pending ' => 'Pending ' , 'new ' => 'New ' ]],
170
- ['new ' , 'payment_action ' , 'payment_action ' , ['pending ' => 'Pending ' ]],
171
- ['processing ' , 'payment_action ' , 'payment_action ' , ['pending ' => 'Pending ' ]],
172
- ['processing ' , 'payment_action ' , null , ['pending ' => 'Pending ' , 'processing ' => 'Processing ' ]],
173
- ['processing ' , 'payment_action ' , 'payment_action ' , ['pending ' => 'Pending ' , 'processing ' => 'Processing ' ]]
153
+ ['pending ' , 'payment_action ' , null ],
154
+ ['new ' , 'payment_action ' , null ],
155
+ ['processing ' , 'payment_action ' , null ],
156
+ ['processing ' , 'payment_action ' , 'payment_action ' ]
174
157
];
175
158
}
176
159
}
0 commit comments