|
13 | 13 | use Magento\Framework\App\ProductMetadata;
|
14 | 14 | use Magento\Framework\App\ProductMetadataInterface;
|
15 | 15 | use Magento\Framework\App\Request\Http as HttpRequest;
|
| 16 | +use Magento\Framework\Exception\NoSuchEntityException; |
16 | 17 | use Magento\Framework\Message\MessageInterface;
|
17 | 18 | use Magento\Framework\Registry;
|
18 | 19 | use Magento\TestFramework\Catalog\Model\CategoryLayoutUpdateManager;
|
@@ -99,7 +100,7 @@ protected function setUp(): void
|
99 | 100 | * @param array $defaultAttributes
|
100 | 101 | * @param array $attributesSaved
|
101 | 102 | * @return void
|
102 |
| - * @throws \Magento\Framework\Exception\NoSuchEntityException |
| 103 | + * @throws NoSuchEntityException |
103 | 104 | */
|
104 | 105 | public function testSaveAction(array $inputData, array $defaultAttributes, array $attributesSaved = []): void
|
105 | 106 | {
|
@@ -145,7 +146,7 @@ public function testSaveAction(array $inputData, array $defaultAttributes, array
|
145 | 146 | * @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories.php
|
146 | 147 | * @return void
|
147 | 148 | * @throws \Magento\Framework\Exception\CouldNotSaveException
|
148 |
| - * @throws \Magento\Framework\Exception\NoSuchEntityException |
| 149 | + * @throws NoSuchEntityException |
149 | 150 | */
|
150 | 151 | public function testDefaultValueForCategoryUrlPath(): void
|
151 | 152 | {
|
@@ -237,6 +238,39 @@ public static function categoryCreatedFromProductCreationPageDataProvider(): arr
|
237 | 238 | return [[$postData], [$postData + ['return_session_messages_only' => 1]]];
|
238 | 239 | }
|
239 | 240 |
|
| 241 | + /** |
| 242 | + * Test save action with different store |
| 243 | + * |
| 244 | + * @return void |
| 245 | + * @throws NoSuchEntityException |
| 246 | + * @magentoDbIsolation enabled |
| 247 | + */ |
| 248 | + public function testSaveActionWithDifferentStore(): void |
| 249 | + { |
| 250 | + $categoryDetails = |
| 251 | + [ |
| 252 | + 'id' => '20', |
| 253 | + 'entity_id' => '20', |
| 254 | + 'path' => '1/2', |
| 255 | + 'url_key' => 'test-category', |
| 256 | + 'is_anchor' => false, |
| 257 | + 'use_default' => |
| 258 | + [ |
| 259 | + 'name' => 'test-category', |
| 260 | + 'is_active' => 1, |
| 261 | + 'thumbnail' => 1, |
| 262 | + 'description' => 'Test description for test-category' |
| 263 | + ] |
| 264 | + ]; |
| 265 | + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); |
| 266 | + $this->getRequest()->setPostValue($categoryDetails); |
| 267 | + $this->getRequest()->setParam('id', $categoryDetails['id']); |
| 268 | + |
| 269 | + $this->dispatch('backend/catalog/category/save'); |
| 270 | + $body = $this->getResponse()->getBody(); |
| 271 | + $this->assertEmpty($body); |
| 272 | + } |
| 273 | + |
240 | 274 | /**
|
241 | 275 | * Test SuggestCategories finds any categories.
|
242 | 276 | *
|
|
0 commit comments