Skip to content

Commit e24dcb9

Browse files
committed
MC-39477: Cart Price rule not working where condition has Category "IS NOT"
- Testing operator and the test
1 parent 285b397 commit e24dcb9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

app/code/Magento/Rule/Model/Condition/AbstractCondition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ public function validateAttribute($validatedValue)
838838
}
839839
}
840840
} elseif (is_array($value)) {
841-
if (!is_array($validatedValue)) {
841+
if (!is_array($validatedValue) || empty($validatedValue)) {
842842
return false;
843843
}
844844
$result = array_intersect($value, $validatedValue);

app/code/Magento/Rule/Test/Unit/Model/Condition/AbstractConditionTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ public function validateAttributeDataProvider()
9191
[1, '>=', '1', true],
9292
[1, '>=', 0, false],
9393
[0, '<', [1], false],
94+
95+
[[1], '!{}', [], false],
96+
[[1], '!{}', [1], false],
97+
[[1], '!{}', [0], false],
9498
];
9599
}
96100

@@ -176,6 +180,8 @@ public function validateAttributeArrayInputTypeDataProvider()
176180
[[3], '{}', [], false, 'grid'],
177181
[1, '{}', 1, false, 'grid'],
178182
[1, '!{}', [1, 2, 3], false, 'grid'],
183+
[1, '!{}', [], false, 'grid'],
184+
[[1], '!{}', [], false, 'grid'],
179185
[[1], '{}', null, false, 'grid'],
180186
[null, '{}', null, true, 'input'],
181187
[null, '!{}', null, false, 'input'],

0 commit comments

Comments
 (0)