LandingPageNotFoundException example

$products = $listing['elements'];
        foreach ($products as $product) {
            static::assertEquals(['name', 'tax', 'manufacturer', 'id', 'apiAlias']array_keys($product));
            static::assertEquals(['name', 'id', 'apiAlias']array_keys($product['tax']));
        }
    }

    private function assertError(string $landingPageId): void
    {
        $response = json_decode($this->browser->getResponse()->getContent(), true, 512, \JSON_THROW_ON_ERROR);
        $error = new LandingPageNotFoundException($landingPageId);
        $expectedError = [
            'status' => (string) $error->getStatusCode(),
            'message' => $error->getMessage(),
        ];

        static::assertSame($expectedError['status']$response['errors'][0]['status']);
        static::assertSame($expectedError['message']$response['errors'][0]['detail']);
    }

    private function createData(array $override = []): void
    {
        
self::assertPageEvent(LandingPageLoadedEvent::class$event$context$request$page);
    }

    public function testLoadWithInactiveLandingPage(): void
    {
        $this->ids = new TestDataCollection();

        $request = new Request([][][
            'landingPageId' => $this->ids->create('landing-page'),
        ]);
        $this->expectExceptionObject(new LandingPageNotFoundException($this->ids->get('landing-page')));

        $context = $this->createSalesChannelContextWithNavigation();
        $this->ids->set('sales-channel', $context->getSalesChannelId());
        $this->createData(false);

        $this->getPageLoader()->load($request$context);
    }

    public function testLoadWithoutCmsPage(): void
    {
        $this->ids = new TestDataCollection();

        
$criteria = new Criteria([$landingPageId]);
        $criteria->setTitle('landing-page::data');

        $criteria->addFilter(new EqualsFilter('active', true));
        $criteria->addFilter(new EqualsFilter('salesChannels.id', $context->getSalesChannel()->getId()));

        $landingPage = $this->landingPageRepository
            ->search($criteria$context)
            ->get($landingPageId);

        if (!$landingPage) {
            throw new LandingPageNotFoundException($landingPageId);
        }

        return $landingPage;
    }

    private function createCriteria(string $pageId, Request $request): Criteria
    {
        $criteria = new Criteria([$pageId]);
        $criteria->setTitle('landing-page::cms-page');

        $slots = $request->get('slots');

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