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 1111use Magento \Catalog \Api \Data \CategoryInterface ;
1212use Magento \Catalog \Model \Category ;
1313use Magento \Cms \Api \GetBlockByIdentifierInterface ;
14+ use Magento \Framework \App \Request \Http as HttpRequest ;
1415use Magento \Framework \Exception \NoSuchEntityException ;
16+ use Magento \Framework \Message \MessageInterface ;
1517use Magento \Store \Model \StoreManagerInterface ;
1618
1719/**
@@ -87,4 +89,24 @@ public function testCreateCategoryWithCmsBlock(): void
8789 $ category = $ this ->categoryRepository ->get ($ this ->createdCategoryId );
8890 $ this ->assertEquals ($ blockId , $ category ->getLandingPage ());
8991 }
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+ }
90112}
You can’t perform that action at this time.
0 commit comments