Skip to content

Commit 686a71c

Browse files
MC-19716: Cannot change action settings of scheduled update for cart rule
1 parent 377c4aa commit 686a71c

File tree

1 file changed

+51
-11
lines changed

1 file changed

+51
-11
lines changed

dev/tests/integration/testsuite/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/NewActionHtmlTest.php

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,75 @@
77

88
namespace Magento\SalesRule\Controller\Adminhtml\Promo\Quote;
99

10-
use Magento\TestFramework\Helper\Bootstrap;
1110
use Magento\TestFramework\TestCase\AbstractBackendController;
1211

1312
/**
1413
* New action html test
14+
*
15+
* @magentoAppArea adminhtml
1516
*/
1617
class NewActionHtmlTest extends AbstractBackendController
1718
{
19+
/**
20+
* @var string
21+
*/
22+
protected $resource = 'Magento_SalesRule::quote';
23+
24+
/**
25+
* @var string
26+
*/
27+
protected $uri = 'backend/sales_rule/promo_quote/newActionHtml';
28+
29+
/**
30+
* @var string
31+
*/
32+
private $formName = 'test_form';
33+
1834
/**
1935
* Test verifies that execute method has the proper data-form-part value in html response
2036
*
2137
* @return void
2238
*/
2339
public function testExecute(): void
2440
{
25-
$formName = 'test_form';
41+
$this->prepareRequest();
42+
$this->dispatch($this->uri);
43+
$html = $this->getResponse()
44+
->getBody();
45+
$this->assertContains($this->formName, $html);
46+
}
47+
48+
/**
49+
* @inheritdoc
50+
*/
51+
public function testAclHasAccess()
52+
{
53+
$this->prepareRequest();
54+
parent::testAclHasAccess();
55+
}
56+
57+
/**
58+
* @inheritdoc
59+
*/
60+
public function testAclNoAccess()
61+
{
62+
$this->prepareRequest();
63+
parent::testAclNoAccess();
64+
}
65+
66+
/**
67+
* Prepare request
68+
*
69+
* @return void
70+
*/
71+
private function prepareRequest(): void
72+
{
2673
$this->getRequest()->setParams(
2774
[
2875
'id' => 1,
29-
'form_namespace' => $formName,
76+
'form_namespace' => $this->formName,
3077
'type' => 'Magento\SalesRule\Model\Rule\Condition\Product|quote_item_price',
3178
]
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);
79+
)->setMethod('POST');
4080
}
4181
}

0 commit comments

Comments
 (0)