13
13
use Magento \CatalogImportExport \Model \Import \Product \Type \AbstractType ;
14
14
use Magento \Framework \Exception \AlreadyExistsException ;
15
15
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager as ObjectManagerHelper ;
16
+ use Magento \Store \Model \Store ;
16
17
use PHPUnit \Framework \MockObject \MockObject ;
17
18
use PHPUnit \Framework \TestCase ;
18
19
19
20
class CategoryProcessorTest extends TestCase
20
21
{
21
- const PARENT_CATEGORY_ID = 1 ;
22
+ public const PARENT_CATEGORY_ID = 1 ;
22
23
23
- const CHILD_CATEGORY_ID = 2 ;
24
+ public const CHILD_CATEGORY_ID = 2 ;
24
25
25
- const CHILD_CATEGORY_NAME = 'Child ' ;
26
+ public const CHILD_CATEGORY_NAME = 'Child ' ;
26
27
27
28
/**
28
29
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
@@ -48,7 +49,7 @@ class CategoryProcessorTest extends TestCase
48
49
private $ childCategory ;
49
50
50
51
/**
51
- * \Magento\Catalog\Model\Category
52
+ * @var \Magento\Catalog\Model\Category
52
53
*/
53
54
private $ parentCategory ;
54
55
@@ -200,4 +201,19 @@ protected function setPropertyValue(&$object, $property, $value)
200
201
$ reflectionProperty ->setValue ($ object , $ value );
201
202
return $ object ;
202
203
}
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
+ }
203
219
}
0 commit comments