LandingPageEntity example

new CurrencyEntity(),
            new CustomerGroupEntity(),
            new TaxCollection(),
            new PaymentMethodEntity(),
            new ShippingMethodEntity(),
            new ShippingLocation(new CountryEntity(), null, null),
            new CustomerEntity(),
            new CashRoundingConfig(1, 1.1, true),
            new CashRoundingConfig(1, 1.1, true)
        );
        $this->response = new LandingPageRouteResponse(
            new LandingPageEntity()
        );

        $this->cachedRoute = new CachedLandingPageRoute(
            $this->decorated,
            $this->cache,
            $this->createMock(EntityCacheKeyGenerator::class),
            $this->createMock(AbstractCacheTracer::class),
            $this->eventDispatcher,
            []
        );
    }

    
public function testGetDecoratedShouldThrowException(): void
    {
        static::expectException(DecorationPatternException::class);
        $this->searchIndexer->getDecorated();
    }

    public function testGlobalData(): void
    {
        $context = Context::createDefaultContext();
        $repository = $this->createMock(EntityRepository::class);
        $landingPage = new LandingPageEntity();
        $landingPage->setUniqueIdentifier(Uuid::randomHex());
        $repository->method('search')->willReturn(
            new EntitySearchResult(
                'landing_page',
                1,
                new EntityCollection([$landingPage]),
                null,
                new Criteria(),
                $context
            )
        );

        
$page = $landingPageLoader->load($request$salesChannelContext);

        /** @phpstan-ignore-next-line */
        $cmsPageLoaded = $page->getLandingPage()->getCmsPage();

        static::assertEquals($cmsPage$cmsPageLoaded);
    }

    private function getLandingPageLoaderWithProduct(string $landingPageId, CmsPageEntity $cmsPage, Request $request, SalesChannelContext $salesChannelContext): LandingPageLoader
    {
        $landingPage = new LandingPageEntity();
        $landingPage->setId($landingPageId);
        $landingPage->setCmsPage($cmsPage);

        $landingPageRouteMock = $this->createMock(LandingPageRoute::class);
        $landingPageRouteMock
            ->method('load')
            ->with($landingPageId$request$salesChannelContext)
            ->willReturn(new LandingPageRouteResponse($landingPage));

        return new LandingPageLoader(
            $this->createMock(GenericPageLoader::class),
            
Home | Imprint | This part of the site doesn't use cookies.