createTestLandingPage example

$this->seoUrlTemplateRepository = $this->getContainer()->get('seo_url_template.repository');
        $this->landingPageRepository = $this->getContainer()->get('landing_page.repository');

        $this->seoUrlGenerator = $this->getContainer()->get(SeoUrlGenerator::class);
    }

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

        $id = $this->createTestLandingPage(['salesChannels' => [
            [
                'id' => $salesChannelContext->getSalesChannelId(),
            ],
        ]]);

        $criteria = new Criteria([$id]);
        $criteria->addAssociation('seoUrls');

        /** @var LandingPageEntity $landingPage */
        $landingPage = $this->landingPageRepository->search($criteria$salesChannelContext->getContext())->first();

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