assertCategoriesInheritance example

'id' => $ids->create('variant-2'),
                'parentId' => $ids->get('parent'),
                'stock' => 10,
                'productNumber' => $ids->get('variant-2'),
            ],
        ];

        $this->getContainer()->get('product.repository')
            ->create($products, Context::createDefaultContext());

        // test variants should inherit the parent categories         $this->assertCategoriesInheritance($ids->get('parent')$ids->get('parent'));
        $this->assertCategoriesInheritance($ids->get('variant-1')$ids->get('parent'));
        $this->assertCategoriesInheritance($ids->get('variant-2')$ids->get('parent'));

        // test assign own variant category         $this->getContainer()->get('product.repository')
            ->update([
                [
                    'id' => $ids->get('variant-1'),
                    'categories' => [
                        ['id' => $ids->create('variant-1-category'), 'name' => 'test12'],
                    ],
                ],
Home | Imprint | This part of the site doesn't use cookies.