Skip to content

Commit 37e8bf8

Browse files
committed
ACP2E-3947: Order status stuck on Processing
1 parent c0a0773 commit 37e8bf8

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

app/code/Magento/Sales/Test/Unit/Model/OrderTest.php

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2013 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

88
namespace Magento\Sales\Test\Unit\Model;
99

1010
use Magento\Catalog\Api\Data\ProductInterface;
11+
use Magento\Catalog\Model\Product;
12+
use Magento\Catalog\Model\Product\Type;
1113
use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection;
1214
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory;
1315
use Magento\Framework\Api\SearchCriteria;
@@ -213,6 +215,49 @@ protected function setUp(): void
213215
);
214216
}
215217

218+
/**
219+
* @return void
220+
* @throws \PHPUnit\Framework\MockObject\Exception
221+
*/
222+
public function testCanShipBundleWithToghetherShipment(): void
223+
{
224+
$this->order->setActionFlag($this->order::ACTION_FLAG_UNHOLD, false);
225+
$this->order->setActionFlag($this->order::ACTION_FLAG_SHIP, true);
226+
227+
$bundleItem = $this->createMock(Item::class);
228+
$bundleItem->expects($this->any())->method('getParentItem')->willReturn(null);
229+
$bundleItem->expects($this->exactly(2))->method('getQtyToShip')->willReturn(0);
230+
$bundleItem->expects($this->any())->method('getProductType')->willReturn(Type::TYPE_BUNDLE);
231+
232+
$product = $this->getMockBuilder(Product::class)
233+
->disableOriginalConstructor()
234+
->addMethods(['getShipmentType'])
235+
->getMock();
236+
$product->expects($this->any())
237+
->method('getShipmentType')
238+
->willReturn(Type\AbstractType::SHIPMENT_TOGETHER);
239+
$bundleItem->expects($this->any())->method('getProduct')->willReturn($product);
240+
241+
$childProduct = $this->createMock(Item::class);
242+
$childProduct->expects($this->any())->method('getParentItem')->willReturn($bundleItem);
243+
244+
$orderItems = [$bundleItem, $childProduct];
245+
$this->searchCriteriaBuilder->expects($this->once())->method('addFilter')->willReturnSelf();
246+
247+
$searchCriteria = $this->getMockBuilder(SearchCriteria::class)
248+
->disableOriginalConstructor()
249+
->getMockForAbstractClass();
250+
$this->searchCriteriaBuilder->expects($this->once())->method('create')->willReturn($searchCriteria);
251+
$itemsCollection = $this->getMockBuilder(OrderItemSearchResultInterface::class)
252+
->onlyMethods(['getItems'])
253+
->disableOriginalConstructor()
254+
->getMockForAbstractClass();
255+
$itemsCollection->expects($this->once())->method('getItems')->willReturn($orderItems);
256+
$this->itemRepository->expects($this->once())->method('getList')->willReturn($itemsCollection);
257+
258+
$this->assertFalse($this->order->canShip());
259+
}
260+
216261
/**
217262
* Test testGetItems method.
218263
*/

0 commit comments

Comments
 (0)