assertProductNames example

$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],
        ]$ids->get('child'));
        $this->assertProductNames([
            ['parent-original-en-GB', $enContext],
            ['parent-original-de-DE', $deContext],
            ['parent-original-en-GB', $enVersionContext],
            ['parent-original-de-DE', $deVersionContext],
        ]$ids->get('parent'));
    }
Home | Imprint | This part of the site doesn't use cookies.