CmsRouteResponse example

public function testPageNoId(): void
    {
        $this->expectException(RoutingException::class);
        $this->expectExceptionMessage('Parameter "id" is missing.');

        $this->controller->page(null, new Request()$this->createMock(SalesChannelContext::class));
    }

    public function testPageReturn(): void
    {
        $cmsRouteResponse = new CmsRouteResponse(new CmsPageEntity());
        $this->cmsRouteMock->method('load')->willReturn($cmsRouteResponse);

        $ids = new IdsCollection();

        $this->controller->page($ids->get('page')new Request()$this->createMock(SalesChannelContext::class));

        static::assertEquals($cmsRouteResponse->getCmsPage()$this->controller->renderStorefrontParameters['cmsPage']);
    }

    public function testCategoryNoId(): void
    {
        
$criteria
                ->getAssociation('sections.blocks')
                ->addFilter(new EqualsAnyFilter('slots.id', $slots));
        }

        $pages = $this->cmsPageLoader->load($request$criteria$context);

        if (!$pages->has($id)) {
            throw new PageNotFoundException($id);
        }

        return new CmsRouteResponse($pages->get($id));
    }
}
Home | Imprint | This part of the site doesn't use cookies.