10
10
use Magento \SalesInventory \Model \Order \ReturnProcessor ;
11
11
use Magento \SalesInventory \Observer \RefundOrderInventoryObserver ;
12
12
13
+ /**
14
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
15
+ */
13
16
class RefundOrderInventoryObserverTest extends \PHPUnit_Framework_TestCase
14
17
{
15
18
/**
@@ -70,23 +73,23 @@ class RefundOrderInventoryObserverTest extends \PHPUnit_Framework_TestCase
70
73
protected function setUp ()
71
74
{
72
75
$ this ->stockIndexerProcessor = $ this ->getMock (
73
- ' Magento\CatalogInventory\Model\Indexer\Stock\Processor ' ,
76
+ \ Magento \CatalogInventory \Model \Indexer \Stock \Processor::class ,
74
77
['reindexList ' ],
75
78
[],
76
79
'' ,
77
80
false
78
81
);
79
82
80
83
$ this ->stockManagement = $ this ->getMock (
81
- ' Magento\CatalogInventory\Model\StockManagement ' ,
84
+ \ Magento \CatalogInventory \Model \StockManagement::class ,
82
85
[],
83
86
[],
84
87
'' ,
85
88
false
86
89
);
87
90
88
91
$ this ->stockConfiguration = $ this ->getMockForAbstractClass (
89
- ' Magento\CatalogInventory\Api\StockConfigurationInterface ' ,
92
+ \ Magento \CatalogInventory \Api \StockConfigurationInterface::class ,
90
93
[
91
94
'isAutoReturnEnabled ' ,
92
95
'isDisplayProductStockStatus '
@@ -95,16 +98,16 @@ protected function setUp()
95
98
false
96
99
);
97
100
98
- $ this ->priceIndexer = $ this ->getMockBuilder (' Magento\Catalog\Model\Indexer\Product\Price\Processor ' )
101
+ $ this ->priceIndexer = $ this ->getMockBuilder (\ Magento \Catalog \Model \Indexer \Product \Price \Processor::class )
99
102
->disableOriginalConstructor ()
100
103
->getMock ();
101
104
102
- $ this ->event = $ this ->getMockBuilder (' Magento\Framework\Event ' )
105
+ $ this ->event = $ this ->getMockBuilder (\ Magento \Framework \Event::class )
103
106
->disableOriginalConstructor ()
104
107
->setMethods (['getProduct ' , 'getCollection ' , 'getCreditmemo ' , 'getQuote ' , 'getWebsite ' ])
105
108
->getMock ();
106
109
107
- $ this ->eventObserver = $ this ->getMockBuilder (' Magento\Framework\Event\Observer ' )
110
+ $ this ->eventObserver = $ this ->getMockBuilder (\ Magento \Framework \Event \Observer::class )
108
111
->disableOriginalConstructor ()
109
112
->setMethods (['getEvent ' ])
110
113
->getMock ();
@@ -113,10 +116,6 @@ protected function setUp()
113
116
->method ('getEvent ' )
114
117
->will ($ this ->returnValue ($ this ->event ));
115
118
116
- <<<<<<< HEAD
117
- $ this ->observer = (new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this ))->getObject (
118
- 'Magento\CatalogInventory\Observer\RefundOrderInventoryObserver ' ,
119
- =======
120
119
$ this ->orderRepositoryMock = $ this ->getMockBuilder (OrderRepository::class)
121
120
->disableOriginalConstructor ()
122
121
->getMock ();
@@ -133,7 +132,6 @@ protected function setUp()
133
132
134
133
$ this ->observer = $ this ->objectManagerHelper ->getObject (
135
134
\Magento \SalesInventory \Observer \RefundOrderInventoryObserver::class,
136
- >>>>>>> e0d9191.. . MAGETWO -59074 : Creditmemo return to stock only one unit of configurable product
137
135
[
138
136
'stockConfiguration ' => $ this ->stockConfiguration ,
139
137
'stockManagement ' => $ this ->stockManagement ,
@@ -160,28 +158,13 @@ public function testRefundOrderInventory()
160
158
$ items = [];
161
159
$ isAutoReturnEnabled = true ;
162
160
163
- <<<<<<< HEAD
164
- $ store = $ this ->getMock (
165
- 'Magento\Store\Model\Store ' ,
166
- ['getWebsiteId ' ],
167
- [],
168
- '' ,
169
- false
170
- );
171
- $ store ->expects ($ this ->once ())->method ('getWebsiteId ' )->will ($ this ->returnValue ($ websiteId ));
172
- =======
173
161
$ creditMemo = $ this ->getMock (\Magento \Sales \Model \Order \Creditmemo::class, [], [], '' , false );
174
- >>>>>>> e0d9191.. . MAGETWO -59074 : Creditmemo return to stock only one unit of configurable product
175
162
176
163
foreach ($ ids as $ id ) {
177
164
$ item = $ this ->getCreditMemoItem ($ id );
178
165
$ items [] = $ item ;
179
166
}
180
- <<<<<<< HEAD
181
- $ creditMemo = $ this ->getMock ('Magento\Sales\Model\Order\Creditmemo ' , [], [], '' , false );
182
- =======
183
167
184
- >>>>>>> e0d9191.. . MAGETWO -59074 : Creditmemo return to stock only one unit of configurable product
185
168
$ creditMemo ->expects ($ this ->once ())
186
169
->method ('getItems ' )
187
170
->will ($ this ->returnValue ($ items ));
@@ -209,26 +192,14 @@ private function getCreditMemoItem($productId)
209
192
{
210
193
$ backToStock = true ;
211
194
$ item = $ this ->getMock (
212
- <<<<<<< HEAD
213
- 'Magento\Sales\Model\Order\Creditmemo\Item ' ,
214
- ['getProductId ' , 'getOrderItem ' , 'getBackToStock ' , 'getQty ' , '__wakeup ' ],
215
- =======
216
195
\Magento \Sales \Model \Order \Creditmemo \Item::class,
217
196
['getOrderItemId ' , 'getBackToStock ' , 'getQty ' , '__wakeup ' ],
218
- >>>>>>> e0d9191.. . MAGETWO -59074 : Creditmemo return to stock only one unit of configurable product
219
197
[],
220
198
'' ,
221
199
false
222
200
);
223
- <<<<<<< HEAD
224
- $ orderItem = $ this ->getMock ('Magento\Sales\Model\Order\Item ' , ['getParentItemId ' , '__wakeup ' ], [], '' , false );
225
- $ orderItem ->expects ($ this ->any ())->method ('getParentItemId ' )->willReturn ($ parentItemId );
226
- $ item ->expects ($ this ->any ())->method ('getOrderItem ' )->willReturn ($ orderItem );
227
- $ item ->expects ($ this ->any ())->method ('getProductId ' )->will ($ this ->returnValue ($ productId ));
228
- =======
229
- >>>>>>> e0d9191.. . MAGETWO -59074 : Creditmemo return to stock only one unit of configurable product
230
201
$ item ->expects ($ this ->any ())->method ('getBackToStock ' )->willReturn ($ backToStock );
231
202
$ item ->expects ($ this ->any ())->method ('getOrderItemId ' )->willReturn ($ productId );
232
203
return $ item ;
233
204
}
234
- }
205
+ }
0 commit comments