createParentChildProduct example

static::assertSame('version-en-GB', $enVersion->getName());
        static::assertSame('original-de-DE', $deOriginal->getName());
        static::assertSame('original-de-DE', $deVersion->getName());
    }

    public function testInheritenceWithProductsAllAreTranslated(): void
    {
        $enContext = Context::createDefaultContext();
        $deContext = $this->createDeContext($enContext);
        $productRepository = $this->getContainer()->get('product.repository');

        $ids = $this->createParentChildProduct();

        $enVersionContext = $enContext->createWithVersionId($productRepository->createVersion($ids->get('child')$enContext));
        $deVersionContext = $deContext->createWithVersionId($productRepository->createVersion($ids->get('child')$deContext));
        $productRepository->update([['id' => $ids->get('child'), 'name' => 'child-version-en-GB']]$enVersionContext);
        $productRepository->update([['id' => $ids->get('child'), 'name' => 'child-version-de-DE']]$deVersionContext);

        $this->assertProductNames([
            ['child-original-en-GB', $enContext],
            ['child-original-de-DE', $deContext],
            ['child-version-en-GB', $enVersionContext],
            ['child-version-de-DE', $deVersionContext],
        ],
Home | Imprint | This part of the site doesn't use cookies.