File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed
dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 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 \Catalog \Controller \Adminhtml \Category ;
9+
10+ use Magento \TestFramework \TestCase \AbstractBackendController ;
11+
12+ /**
13+ * Tests for catalog category Add controller
14+ *
15+ * @see \Magento\Catalog\Controller\Adminhtml\Category\Add
16+ *
17+ * @magentoAppArea adminhtml
18+ */
19+ class AddTest extends AbstractBackendController
20+ {
21+ /**
22+ * @var int
23+ */
24+ const DEFAULT_ROOT_CATEGORY = 2 ;
25+
26+ /**
27+ * @inheritdoc
28+ */
29+ protected function setUp (): void
30+ {
31+ parent ::setUp ();
32+
33+ $ this ->getRequest ()->setParams ([]);
34+ }
35+
36+
37+ /**
38+ * @magentoDbIsolation enabled
39+ *
40+ * @return void
41+ */
42+ public function testExecuteWithoutParams (): void
43+ {
44+ $ this ->dispatch ('backend/catalog/category/add ' );
45+ $ this ->assertRedirect ($ this ->stringContains ('catalog/category/index ' ));
46+ }
47+
48+ /**
49+ * @magentoDbIsolation enabled
50+ *
51+ * @return void
52+ */
53+ public function testExecuteAsAjax (): void
54+ {
55+ $ this ->getRequest ()->setQueryValue ('isAjax ' , true );
56+ $ this ->getRequest ()->setParam ('parent ' , self ::DEFAULT_ROOT_CATEGORY );
57+ $ this ->dispatch ('backend/catalog/category/add ' );
58+ $ this ->assertJson ($ this ->getResponse ()->getBody ());
59+ }
60+ }
You can’t perform that action at this time.
0 commit comments