This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ protected function setUp()
49
49
. self ::CHILD_CATEGORY_ID
50
50
));
51
51
52
+ $ childCategory ->method ('save ' )->willThrowException (new \Exception ());
53
+
52
54
$ parentCategory = $ this ->getMockBuilder (\Magento \Catalog \Model \Category::class)
53
55
->disableOriginalConstructor ()
54
56
->getMock ();
@@ -105,6 +107,17 @@ public function testUpsertCategories()
105
107
$ this ->assertArrayHasKey (self ::CHILD_CATEGORY_ID , array_flip ($ categoryIds ));
106
108
}
107
109
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
+
108
121
public function testClearFailedCategories ()
109
122
{
110
123
$ dummyFailedCategory = [
You can’t perform that action at this time.
0 commit comments