Skip to content

Commit 0b1672f

Browse files
committed
MAGETWO-73479: Cart Rules are not excluding Bundle Products
1 parent 02687b7 commit 0b1672f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

app/code/Magento/SalesRule/Test/Unit/Model/RulesApplierTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ class RulesApplierTest extends \PHPUnit\Framework\TestCase
2828
*/
2929
protected $validatorUtility;
3030

31+
/**
32+
* @var \Magento\SalesRule\Model\Quote\ChildrenValidationLocator|\PHPUnit_Framework_MockObject_MockObject
33+
*/
34+
protected $childrenValidationLocator;
35+
3136
protected function setUp()
3237
{
3338
$this->calculatorFactory = $this->createMock(
@@ -38,11 +43,15 @@ protected function setUp()
3843
\Magento\SalesRule\Model\Utility::class,
3944
['canProcessRule', 'minFix', 'deltaRoundingFix', 'getItemQty']
4045
);
41-
46+
$this->childrenValidationLocator = $this->createPartialMock(
47+
\Magento\SalesRule\Model\Quote\ChildrenValidationLocator::class,
48+
['isChildrenValidationRequired']
49+
);
4250
$this->rulesApplier = new \Magento\SalesRule\Model\RulesApplier(
4351
$this->calculatorFactory,
4452
$this->eventManager,
45-
$this->validatorUtility
53+
$this->validatorUtility,
54+
$this->childrenValidationLocator
4655
);
4756
}
4857

@@ -84,6 +93,10 @@ public function testApplyRulesWhenRuleWithStopRulesProcessingIsUsed($isChildren,
8493
$item->setDiscountCalculationPrice($positivePrice);
8594
$item->setData('calculation_price', $positivePrice);
8695

96+
$this->childrenValidationLocator->expects($this->any())
97+
->method('isChildrenValidationRequired')
98+
->will($this->returnValue(true));
99+
87100
$this->validatorUtility->expects($this->atLeastOnce())
88101
->method('canProcessRule')
89102
->will($this->returnValue(true));

0 commit comments

Comments
 (0)