Skip to content

Commit 3557f77

Browse files
MC-19716: Cannot change action settings of scheduled update for cart rule
1 parent 9395f55 commit 3557f77

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/NewActionHtml.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\SalesRule\Controller\Adminhtml\Promo\Quote;
87

9-
class NewActionHtml extends \Magento\SalesRule\Controller\Adminhtml\Promo\Quote
8+
use Magento\Framework\App\Action\HttpPostActionInterface;
9+
use Magento\SalesRule\Controller\Adminhtml\Promo\Quote;
10+
11+
/**
12+
* New action html action
13+
*/
14+
class NewActionHtml extends Quote implements HttpPostActionInterface
1015
{
1116
/**
1217
* New action html action
@@ -37,7 +42,6 @@ public function execute()
3742

3843
if ($model instanceof \Magento\Rule\Model\Condition\AbstractCondition) {
3944
$model->setJsFormObject($formName);
40-
$model->setFormName($formName);
4145
$html = $model->asHtmlRecursive();
4246
} else {
4347
$html = '';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\SalesRule\Controller\Adminhtml\Promo\Quote;
9+
10+
use Magento\TestFramework\Helper\Bootstrap;
11+
use Magento\TestFramework\TestCase\AbstractBackendController;
12+
13+
/**
14+
* New action html test
15+
*/
16+
class NewActionHtmlTest extends AbstractBackendController
17+
{
18+
/**
19+
* Test verifies that execute method has the proper data-form-part value in html response
20+
*
21+
* @return void
22+
*/
23+
public function testExecute(): void
24+
{
25+
$formName = 'test_form';
26+
$this->getRequest()->setParams(
27+
[
28+
'id' => 1,
29+
'form_namespace' => $formName,
30+
'type' => 'Magento\SalesRule\Model\Rule\Condition\Product|quote_item_price',
31+
]
32+
);
33+
$objectManager = Bootstrap::getObjectManager();
34+
/** @var NewActionHtml $controller */
35+
$controller = $objectManager->create(NewActionHtml::class);
36+
$controller->execute();
37+
$html = $this->getResponse()
38+
->getBody();
39+
$this->assertContains($formName, $html);
40+
}
41+
}

0 commit comments

Comments
 (0)