Skip to content

Commit 87e0647

Browse files
committed
MAGETWO-57880: [GITHUB] Cancel an order of bundle product #5194
1 parent a1724ae commit 87e0647

File tree

2 files changed

+11
-1
lines changed
  • app/code/Magento/Bundle

2 files changed

+11
-1
lines changed

app/code/Magento/Bundle/Model/Sales/Order/Plugin/Item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function afterGetQtyToCancel(\Magento\Sales\Model\Order\Item $subject, $r
3838
*/
3939
public function afterIsProcessingAvailable(\Magento\Sales\Model\Order\Item $subject, $result)
4040
{
41-
if ($subject->getParentItem()
41+
if ($subject->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE || $subject->getParentItem()
4242
&& $subject->getParentItem()->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
4343
) {
4444
return $subject->getSimpleQtyToShip() > $subject->getQtyToCancel();

app/code/Magento/Bundle/Test/Unit/Model/Sales/Order/Plugin/ItemTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,14 @@ public function testAfterIsProcessingAvailableForProductWhenParentIsBundle()
8787
$this->itemMock->expects($this->once())->method('getQtyToCancel')->willReturn(5);
8888
$this->assertTrue($this->plugin->afterIsProcessingAvailable($this->itemMock, false));
8989
}
90+
91+
public function testAfterIsProcessingAvailableForBundleProduct()
92+
{
93+
$this->itemMock->expects($this->once())
94+
->method('getProductType')
95+
->willReturn(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE);
96+
$this->itemMock->expects($this->once())->method('getSimpleQtyToShip')->willReturn(10);
97+
$this->itemMock->expects($this->once())->method('getQtyToCancel')->willReturn(5);
98+
$this->assertTrue($this->plugin->afterIsProcessingAvailable($this->itemMock, false));
99+
}
90100
}

0 commit comments

Comments
 (0)