1313use Magento \CatalogImportExport \Model \Import \Product \Type \AbstractType ;
1414use Magento \Framework \Exception \AlreadyExistsException ;
1515use Magento \Framework \TestFramework \Unit \Helper \ObjectManager as ObjectManagerHelper ;
16+ use Magento \Store \Model \Store ;
1617use PHPUnit \Framework \MockObject \MockObject ;
1718use PHPUnit \Framework \TestCase ;
1819
1920class CategoryProcessorTest extends TestCase
2021{
21- const PARENT_CATEGORY_ID = 1 ;
22+ public const PARENT_CATEGORY_ID = 1 ;
2223
23- const CHILD_CATEGORY_ID = 2 ;
24+ public const CHILD_CATEGORY_ID = 2 ;
2425
25- const CHILD_CATEGORY_NAME = 'Child ' ;
26+ public const CHILD_CATEGORY_NAME = 'Child ' ;
2627
2728 /**
2829 * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -48,7 +49,7 @@ class CategoryProcessorTest extends TestCase
4849 private $ childCategory ;
4950
5051 /**
51- * \Magento\Catalog\Model\Category
52+ * @var \Magento\Catalog\Model\Category
5253 */
5354 private $ parentCategory ;
5455
@@ -200,4 +201,19 @@ protected function setPropertyValue(&$object, $property, $value)
200201 $ reflectionProperty ->setValue ($ object , $ value );
201202 return $ object ;
202203 }
204+
205+ /**
206+ * @throws \ReflectionException
207+ */
208+ public function testCategoriesCreatedForGlobalScope ()
209+ {
210+ $ this ->childCategory ->expects ($ this ->once ())
211+ ->method ('setStoreId ' )
212+ ->with (Store::DEFAULT_STORE_ID );
213+
214+ $ reflection = new \ReflectionClass ($ this ->categoryProcessor );
215+ $ createCategoryReflection = $ reflection ->getMethod ('createCategory ' );
216+ $ createCategoryReflection ->setAccessible (true );
217+ $ createCategoryReflection ->invokeArgs ($ this ->categoryProcessor , ['testCategory ' , 2 ]);
218+ }
203219}
0 commit comments