Skip to content

Commit 75c16a2

Browse files
MAGETWO-69825: [GITHUB #9891] Subcategory "liquid-hand-soap" is not opened in category "soap"
- Resolve merge conflict
1 parent 34c9b4f commit 75c16a2

File tree

1 file changed

+49
-3
lines changed
  • dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml

1 file changed

+49
-3
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
use Magento\Catalog\Model\ResourceModel\Product;
1212
use Magento\Framework\App\Request\Http as HttpRequest;
1313
use Magento\Framework\Message\MessageInterface;
14-
use Magento\Store\Model\Store;
14+
use Magento\Catalog\Api\CategoryRepositoryInterface;
15+
use Magento\Framework\Exception\NoSuchEntityException;
1516
use Magento\TestFramework\Helper\Bootstrap;
17+
use Magento\Store\Model\Store;
1618

1719
/**
18-
* Test class for \Magento\Catalog\Controller\Adminhtml\Category.
20+
* Test for category backend actions
1921
*
2022
* @magentoAppArea adminhtml
2123
*/
@@ -101,7 +103,43 @@ public function testSaveAction($inputData, $defaultAttributes, $attributesSaved
101103
}
102104

103105
/**
104-
* Test save action from product creation page.
106+
* Check default value for category url path
107+
*
108+
* @magentoDbIsolation enabled
109+
* @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories.php
110+
* @throws NoSuchEntityException
111+
*/
112+
public function testDefaultValueForCategoryUrlPath()
113+
{
114+
$repository = $this->_objectManager->get(CategoryRepositoryInterface::class);
115+
$categoryId = 3;
116+
$category = $repository->get($categoryId);
117+
$newUrlPath = 'test_url_path';
118+
$defaultUrlPath = $category->getData('url_path');
119+
120+
// update url_path and check it
121+
$category->setStoreId(1);
122+
$category->setUrlKey($newUrlPath);
123+
$category->setUrlPath($newUrlPath);
124+
$repository->save($category);
125+
$this->assertEquals($newUrlPath, $category->getUrlPath());
126+
127+
// set default url_path and check it
128+
$this->getRequest()->setMethod(HttpRequest::METHOD_POST);
129+
$postData = $category->getData();
130+
$postData['use_default'] = [
131+
'available_sort_by' => 1,
132+
'default_sort_by' => 1,
133+
'url_key' => 1,
134+
];
135+
$this->getRequest()->setPostValue($postData);
136+
$this->dispatch('backend/catalog/category/save');
137+
$category = $repository->get($categoryId);
138+
$this->assertEquals($defaultUrlPath, $category->getData('url_path'));
139+
}
140+
141+
/**
142+
* Test save action from product form page
105143
*
106144
* @param array $postData
107145
* @dataProvider categoryCreatedFromProductCreationPageDataProvider
@@ -138,6 +176,8 @@ public function testSaveActionFromProductCreationPage($postData)
138176
}
139177

140178
/**
179+
* Get category post data
180+
*
141181
* @static
142182
* @return array
143183
*/
@@ -182,6 +222,8 @@ public function testSuggestCategoriesActionNoSuggestions()
182222
}
183223

184224
/**
225+
* Save action data provider
226+
*
185227
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
186228
* @return array
187229
*/
@@ -430,6 +472,8 @@ public function testMoveAction($parentId, $childId, $childUrlKey, $grandChildId,
430472
}
431473

432474
/**
475+
* Move action data provider
476+
*
433477
* @return array
434478
*/
435479
public function moveActionDataProvider()
@@ -472,6 +516,8 @@ public function testSaveCategoryWithProductPosition(array $postData)
472516
}
473517

474518
/**
519+
* Save action data provider
520+
*
475521
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
476522
* @return array
477523
*/

0 commit comments

Comments
 (0)