SeoUrlTemplateEntity example


        $this->getBrowser()->request('POST', '/api/_action/seo-url-template/validate');
        $response = $this->getBrowser()->getResponse();
        $result = json_decode($response->getContent(), true, 512, \JSON_THROW_ON_ERROR);

        static::assertNotEmpty($result['errors']);
        static::assertEquals(400, $response->getStatusCode());
    }

    public function testValidateInvalid(): void
    {
        $template = new SeoUrlTemplateEntity();
        $template->setRouteName('frontend.detail.page');
        $template->setTemplate('{{ product.name }');
        $template->setEntityName($this->getContainer()->get(ProductDefinition::class)->getEntityName());
        $template->setSalesChannelId(TestDefaults::SALES_CHANNEL);

        $this->getBrowser()->request('POST', '/api/_action/seo-url-template/validate', $template->jsonSerialize());
        $response = $this->getBrowser()->getResponse();
        $result = json_decode($response->getContent(), true, 512, \JSON_THROW_ON_ERROR);

        static::assertNotEmpty($result['errors'] ?? []);
        static::assertEquals(400, $response->getStatusCode());
    }
Home | Imprint | This part of the site doesn't use cookies.