File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/Save Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 11
11
use Magento \Catalog \Api \Data \CategoryInterface ;
12
12
use Magento \Catalog \Model \Category ;
13
13
use Magento \Cms \Api \GetBlockByIdentifierInterface ;
14
+ use Magento \Framework \App \Request \Http as HttpRequest ;
14
15
use Magento \Framework \Exception \NoSuchEntityException ;
16
+ use Magento \Framework \Message \MessageInterface ;
15
17
use Magento \Store \Model \StoreManagerInterface ;
16
18
17
19
/**
@@ -87,4 +89,24 @@ public function testCreateCategoryWithCmsBlock(): void
87
89
$ category = $ this ->categoryRepository ->get ($ this ->createdCategoryId );
88
90
$ this ->assertEquals ($ blockId , $ category ->getLandingPage ());
89
91
}
92
+
93
+ /**
94
+ * @return void
95
+ */
96
+ public function testTryToCreateCategoryWithEmptyValues (): void
97
+ {
98
+ $ this ->getRequest ()->setMethod (HttpRequest::METHOD_POST );
99
+ $ this ->getRequest ()->setPostValue ([
100
+ CategoryInterface::KEY_NAME => 'test ' ,
101
+ CategoryInterface::KEY_IS_ACTIVE => 1 ,
102
+ 'use_config ' => [],
103
+ 'return_session_messages_only ' => false ,
104
+ ]);
105
+ $ this ->dispatch ('backend/catalog/category/save ' );
106
+ $ message = (string )__ (
107
+ 'The "%1" attribute is required. Enter and try again. ' ,
108
+ 'Available Product Listing Sort By '
109
+ );
110
+ $ this ->assertSessionMessages ($ this ->containsEqual ($ message ), MessageInterface::TYPE_ERROR );
111
+ }
90
112
}
You can’t perform that action at this time.
0 commit comments