CategoryUrlGenerator example

private const EXTERNAL_URL = 'https://shopware.com/';

    private CategoryUrlGenerator $urlGenerator;

    private MockObject&SeoUrlPlaceholderHandlerInterface $replacer;

    private SalesChannelEntity $salesChannel;

    protected function setUp(): void
    {
        $this->replacer = $this->getMockBuilder(SeoUrlPlaceholderHandlerInterface::class)->getMock();
        $this->urlGenerator = new CategoryUrlGenerator($this->replacer);
        $this->replacer->method('generate')->willReturnArgument(0);
        $this->salesChannel = new SalesChannelEntity();
        $this->salesChannel->setNavigationCategoryId(Uuid::randomHex());
    }

    public function testPage(): void
    {
        $category = new CategoryEntity();
        $category->setId(Uuid::randomHex());
        $category->setType(CategoryDefinition::TYPE_PAGE);

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