Skip to content

Commit 922951b

Browse files
committed
Added Unit Test cases for both Validated value & value
1 parent 46caa5e commit 922951b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-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
@@ -885,7 +885,7 @@ public function validateAttribute($validatedValue)
885885
protected function _compareValues($validatedValue, $value, $strict = true)
886886
{
887887
if ($strict && is_numeric($validatedValue) && is_numeric($value)) {
888-
if (preg_match('/^0\d+$/', $validatedValue)) {
888+
if (preg_match('/^0\d+$/', $validatedValue) || preg_match('/^0\d+$/', $value)) {
889889
return $validatedValue === $value;
890890
}
891891
return $validatedValue == $value;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public static function validateAttributeDataProvider()
6565
[null, '==', 0, false],
6666
[null, '==', 0.00, false],
6767

68+
['0123', '===', '123', false],
69+
['123', '===', '0123', false],
70+
6871
[1, '!=', 1, false],
6972
[0, '!=', 1, true],
7073
['0', '!=', 1, true],

0 commit comments

Comments
 (0)