Code Duplication    Length = 21-21 lines in 2 locations

Test/Unit/Model/Inventory/StockbaseStockManagementTest.php 2 locations

@@ 197-217 (lines=21) @@
194
    /**
195
     * testGetReserveForProduct
196
     */
197
    public function testGetReserveForProduct()
198
    {
199
        $reserveCollection = $this->createMock(StockItemReserveCollection::class);
200
        
201
        $this->objectManager->expects($this->once())->method('create')
202
            ->with(StockItemReserveCollection::class)
203
            ->willReturn($reserveCollection);
204
205
        $reserve = $this->createMock(StockItemReserve::class);
206
        
207
        $reserveCollection->expects($this->any())->method('addFieldToFilter')
208
            ->with('product_id', ['in' => [101]]);
209
        
210
        $reserveCollection->expects($this->once())->method('getItems')
211
            ->willReturn([$reserve]);
212
        
213
        $model = $this->createModel();
214
        $result = $model->getReserveForProduct(101);
215
        
216
        $this->assertEquals([$reserve], $result);
217
    }
218
219
    /**
220
     * testGetReserveForQuoteItem
@@ 222-242 (lines=21) @@
219
    /**
220
     * testGetReserveForQuoteItem
221
     */
222
    public function testGetReserveForQuoteItem()
223
    {
224
        $reserveCollection = $this->createMock(StockItemReserveCollection::class);
225
        
226
        $this->objectManager->expects($this->once())->method('create')
227
            ->with(StockItemReserveCollection::class)
228
            ->willReturn($reserveCollection);
229
230
        $reserve = $this->createMock(StockItemReserve::class);
231
        
232
        $reserveCollection->expects($this->any())->method('addFieldToFilter')
233
            ->with('quote_item_id', ['in' => [101]]);
234
        
235
        $reserveCollection->expects($this->once())->method('getItems')
236
            ->willReturn([$reserve]);
237
        
238
        $model = $this->createModel();
239
        $result = $model->getReserveForQuoteItem(101);
240
            
241
        $this->assertEquals([$reserve], $result);
242
    }
243
    
244
    protected function createModel()
245
    {