15
15
use Magento \Framework \Message \MessageInterface ;
16
16
use Magento \Framework \Serialize \Serializer \Json ;
17
17
use Magento \Store \Api \StoreRepositoryInterface ;
18
- use Magento \TestFramework \TestCase \AbstractBackendController ;
19
18
use Magento \TestFramework \Helper \Bootstrap ;
19
+ use Magento \TestFramework \TestCase \AbstractBackendController ;
20
20
21
21
/**
22
22
* Test for category backend actions
@@ -63,6 +63,7 @@ protected function setUp()
63
63
* @param array $defaultAttributes
64
64
* @param array $attributesSaved
65
65
* @return void
66
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
66
67
*/
67
68
public function testSaveAction (array $ inputData , array $ defaultAttributes , array $ attributesSaved = []): void
68
69
{
@@ -107,6 +108,8 @@ public function testSaveAction(array $inputData, array $defaultAttributes, array
107
108
* @magentoDbIsolation enabled
108
109
* @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories.php
109
110
* @return void
111
+ * @throws \Magento\Framework\Exception\CouldNotSaveException
112
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
110
113
*/
111
114
public function testDefaultValueForCategoryUrlPath (): void
112
115
{
@@ -125,19 +128,20 @@ public function testDefaultValueForCategoryUrlPath(): void
125
128
// set default url_path and check it
126
129
$ this ->getRequest ()->setMethod (HttpRequest::METHOD_POST );
127
130
$ postData = $ category ->getData ();
128
- $ postData ['use_default ' ] = [
129
- 'available_sort_by ' => 1 ,
130
- 'default_sort_by ' => 1 ,
131
- 'url_key ' => 1 ,
132
- ];
131
+ $ postData ['use_default ' ] =
132
+ [
133
+ 'available_sort_by ' => 1 ,
134
+ 'default_sort_by ' => 1 ,
135
+ 'url_key ' => 1 ,
136
+ ];
133
137
$ this ->getRequest ()->setPostValue ($ postData );
134
138
$ this ->dispatch ('backend/catalog/category/save ' );
135
139
$ this ->assertSessionMessages (
136
140
$ this ->equalTo ([(string )__ ('You saved the category. ' )]),
137
141
MessageInterface::TYPE_SUCCESS
138
142
);
139
143
$ category = $ this ->categoryRepository ->get ($ categoryId );
140
- $ this ->assertEquals ($ defaultUrlPath , $ category ->getData ('url_path ' ));
144
+ $ this ->assertEquals ($ defaultUrlPath , $ category ->getData ('url_key ' ));
141
145
}
142
146
143
147
/**
0 commit comments