upsertTemplate example

static::assertCount(1, $canonicalUrls);
        static::assertCount(2, $nonCanonicals);
        static::assertCount(3, $seoUrls);
    }

    public function testCustomNew(): void
    {
        $salesChannelId = Uuid::randomHex();
        $salesChannelContext = $this->createStorefrontSalesChannelContext($salesChannelId, 'test');

        $id = Uuid::randomHex();
        $this->upsertTemplate([
            'id' => $id,
            'salesChannelId' => $salesChannelId,
            'template' => 'foo/{{ product.name }}/bar',
        ]);

        $this->upsertProduct(['id' => $id, 'name' => 'awesome product']$salesChannelId);

        /** @var ProductEntity $first */
        $first = $this->productRepository->search($this->getCriteria($id$salesChannelId)$salesChannelContext->getContext())->first();
        static::assertInstanceOf(SeoUrlCollection::class$first->getSeoUrls());

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