templateParameterIsMissing example

if (!$seoUrlRoute) {
            throw SeoException::seoUrlRouteNotFound($routeName);
        }

        return new JsonResponse(['defaultTemplate' => $seoUrlRoute->getConfig()->getTemplate()]);
    }

    private function validateSeoUrlTemplate(Request $request): void
    {
        if (!$request->request->has('template')) {
            throw SeoException::templateParameterIsMissing();
        }

        if (!$request->request->has('salesChannelId')) {
            throw SeoException::salesChannelIdParameterIsMissing();
        }

        if (!$request->request->has('routeName')) {
            throw SeoException::routeNameParameterIsMissing();
        }

        if (!$request->request->has('entityName')) {
            
public function testSalesChannelIdParameterIsMissing(): void
    {
        $exception = SeoException::salesChannelIdParameterIsMissing();

        static::assertEquals(Response::HTTP_BAD_REQUEST, $exception->getStatusCode());
        static::assertEquals(SeoException::SALES_CHANNEL_ID_PARAMETER_IS_MISSING, $exception->getErrorCode());
        static::assertEquals('Parameter "salesChannelId" is missing.', $exception->getMessage());
    }

    public function testTemplateParameterIsMissing(): void
    {
        $exception = SeoException::templateParameterIsMissing();

        static::assertEquals(Response::HTTP_BAD_REQUEST, $exception->getStatusCode());
        static::assertEquals(SeoException::TEMPLATE_PARAMETER_IS_MISSING, $exception->getErrorCode());
        static::assertEquals('Parameter "template" is missing.', $exception->getMessage());
    }

    public function testEntityNameParameterIsMissing(): void
    {
        $exception = SeoException::entityNameParameterIsMissing();

        static::assertEquals(Response::HTTP_BAD_REQUEST, $exception->getStatusCode());
        
Home | Imprint | This part of the site doesn't use cookies.