getProductCategoryList example

public function testUpdateWithProductAddedCategoriesWillVariantGetSameCategories(): void
    {
        ['products' => $productFixture, 'categories' => $categoryIds] = $this->prepareData();

        $this->productRepository->update([
            [
                'id' => $productFixture['testable-product'],
                'categories' => \array_map(fn (string $categoryId) => ['id' => $categoryId]$categoryIds),
            ],
        ]$this->context);

        static::assertSame($categoryIds$this->getProductCategoryList($productFixture['testable-product']));
        static::assertEquals(
            \count($categoryIds),
            $this->getCountRowsInProductCategoryTree($productFixture['testable-product']$categoryIds)
        );

        static::assertSame($categoryIds$this->getProductCategoryList($productFixture['variant-testable-product']));
        static::assertEquals(
            \count($categoryIds),
            $this->getCountRowsInProductCategoryTree($productFixture['variant-testable-product']$categoryIds)
        );
    }

    
Home | Imprint | This part of the site doesn't use cookies.