Skip to content

Commit e4de0fb

Browse files
committed
ACP2E-3399: GraphQL Response for Order placement does not include the exception message
1 parent 5743eb4 commit e4de0fb

File tree

1 file changed

+12
-20
lines changed
  • dev/tests/integration/testsuite/Magento/Rule/Model/Condition/Sql

1 file changed

+12
-20
lines changed

dev/tests/integration/testsuite/Magento/Rule/Model/Condition/Sql/BuilderTest.php

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
class BuilderTest extends TestCase
3232
{
3333
/**
34-
* @var Builder
34+
* @var Builder|null
3535
*/
36-
private Builder $model;
36+
private ?Builder $model;
3737

3838
/**
39-
* @var DataFixtureStorage
39+
* @var DataFixtureStorage|null
4040
*/
41-
private DataFixtureStorage $fixtures;
41+
private ?DataFixtureStorage $fixtures;
4242

4343
/**
4444
* @inheritDoc
@@ -104,18 +104,10 @@ public function testAttachConditionToCollection(
104104

105105
$rule->loadPost($ruleConditionArray);
106106
foreach ($rule->getConditions()->getConditions() as $condition) {
107+
$condition->addToCollection($collection);
107108
if ($condition->getAttribute() === 'multi_select_attr') {
108-
$productCollection = $this->createMock(Collection::class);
109-
$limitationFilters = $this->createMock(ProductLimitation::class);
110-
$limitationFilters->expects($this->any())->method('isUsingPriceIndex')->willReturn(false);
111-
$productCollection->expects($this->any())
112-
->method('getLimitationFilters')
113-
->willReturn($limitationFilters);
114-
$productCollection->expects($this->any())->method('isEnabledFlat')->willReturn(true);
115-
$select = $this->createMock(Select::class);
116-
$select->expects($this->any())->method('getPart')->willReturn([]);
117-
$productCollection->expects($this->any())->method('getSelect')->willReturn($select);
118-
$condition->addToCollection($productCollection);
109+
$from = array_keys($collection->getSelectSql()->getPart('from'));
110+
$expectedWhere = str_replace('multi_select_attr', end($from), $expectedWhere);
119111
}
120112
}
121113
$this->model->attachConditionToCollection($collection, $rule->getConditions());
@@ -159,7 +151,8 @@ public static function attachConditionToCollectionDataProvider(): array
159151
],
160152
"(((`e`.`entity_id` IN (SELECT `catalog_category_product`.`product_id` FROM " .
161153
"`catalog_category_product` WHERE (category_id IN ('3')))) " .
162-
"AND(`e`.`entity_id` = '2017-09-15 00:00:00') " .
154+
"AND(IF(`at_special_to_date`.`value_id` > 0, `at_special_to_date`.`value`, " .
155+
"`at_special_to_date_default`.`value`) = '2017-09-15 00:00:00') " .
163156
"AND(`e`.`sku` IN ('sku1', 'sku2', 'sku3', 'sku4', 'sku5'))",
164157
"ORDER BY (FIELD(`e`.`sku`, 'sku1', 'sku2', 'sku3', 'sku4', 'sku5'))"
165158
],
@@ -192,10 +185,9 @@ public static function attachConditionToCollectionDataProvider(): array
192185
],
193186
"(((`e`.`entity_id` IN (SELECT `catalog_category_product`.`product_id` FROM " .
194187
"`catalog_category_product` WHERE (category_id IN ('3')))) " .
195-
"AND(`e`.`sku` IN ('sku1', 'sku2', 'sku3')) AND(`at_multi_select_attr`.`value` IN " .
196-
"('red', 'white') OR " .
197-
"(FIND_IN_SET ('red', `at_multi_select_attr`.`value`) > 0) OR " .
198-
"(FIND_IN_SET ('white', `at_multi_select_attr`.`value`) > 0))",
188+
"AND(`e`.`sku` IN ('sku1', 'sku2', 'sku3')) AND(`multi_select_attr`.`value` IN ('red', 'white') OR " .
189+
"(FIND_IN_SET ('red', `multi_select_attr`.`value`) > 0) OR " .
190+
"(FIND_IN_SET ('white', `multi_select_attr`.`value`) > 0))",
199191
"ORDER BY (FIELD(`e`.`sku`, 'sku1', 'sku2', 'sku3'))"
200192
]
201193
];

0 commit comments

Comments
 (0)