Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit dbe5fc7

Browse files
[2.3-develop] Forwardport of magento/magento2#11049
1 parent 76716b8 commit dbe5fc7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/CategoryProcessorTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ protected function setUp()
4949
. self::CHILD_CATEGORY_ID
5050
));
5151

52+
$childCategory->method('save')->willThrowException(new \Exception());
53+
5254
$parentCategory = $this->getMockBuilder(\Magento\Catalog\Model\Category::class)
5355
->disableOriginalConstructor()
5456
->getMock();
@@ -105,6 +107,17 @@ public function testUpsertCategories()
105107
$this->assertArrayHasKey(self::CHILD_CATEGORY_ID, array_flip($categoryIds));
106108
}
107109

110+
/**
111+
* Tests case when newly created category save throws exception.
112+
*/
113+
public function testCreateCategoryException()
114+
{
115+
$method = new \ReflectionMethod(CategoryProcessor::class, 'createCategory');
116+
$method->setAccessible(true);
117+
$method->invoke($this->categoryProcessor, self::CHILD_CATEGORY_NAME, self::PARENT_CATEGORY_ID);
118+
$this->assertNotEmpty($this->categoryProcessor->getFailedCategories());
119+
}
120+
108121
public function testClearFailedCategories()
109122
{
110123
$dummyFailedCategory = [

0 commit comments

Comments
 (0)