@@ -169,7 +169,7 @@ public function productVisibilityProvider(): array
169
169
public function testAnchorCategoryProductVisibility (): void
170
170
{
171
171
$ this ->updateCategoryIsAnchor (400 , true );
172
- $ this ->assignProductCategories ([ 'simple2 ' ] , [402 ]);
172
+ $ this ->assignProductCategories ('simple2 ' , [402 ]);
173
173
$ parentCategoryCollection = $ this ->getCategoryProductCollection (400 );
174
174
$ childCategoryCollection = $ this ->getCategoryProductCollection (402 , true );
175
175
@@ -188,7 +188,7 @@ public function testAnchorCategoryProductVisibility(): void
188
188
public function testNonAnchorCategoryProductVisibility (): void
189
189
{
190
190
$ this ->updateCategoryIsAnchor (400 , false );
191
- $ this ->assignProductCategories ([ 'simple2 ' ] , [402 ]);
191
+ $ this ->assignProductCategories ('simple2 ' , [402 ]);
192
192
$ parentCategoryCollectionSize = $ this ->getCategoryProductCollection (400 )->getSize ();
193
193
$ childCategoryCollectionSize = $ this ->getCategoryProductCollection (402 , true )->getSize ();
194
194
@@ -223,12 +223,13 @@ public function testCategoryProductViewOnMultiWebsite(): void
223
223
/**
224
224
* Set categories to the products
225
225
*
226
- * @param array $skus
226
+ * @param string| array $sku
227
227
* @param $categoryIds
228
228
* @return void
229
229
*/
230
- private function assignProductCategories (array $ skus , array $ categoryIds ): void
230
+ private function assignProductCategories ($ sku , array $ categoryIds ): void
231
231
{
232
+ $ skus = !is_array ($ sku ) ? [$ sku ] : $ sku ;
232
233
foreach ($ skus as $ sku ) {
233
234
$ product = $ this ->productRepository ->get ($ sku );
234
235
$ product ->setCategoryIds ($ categoryIds );
0 commit comments