SitemapHandle example

class SitemapHandleFactory implements SitemapHandleFactoryInterface
{
    /** * @internal */
    public function __construct(private readonly EventDispatcherInterface $eventDispatcher)
    {
    }

    public function create(FilesystemOperator $filesystem, SalesChannelContext $context, ?string $domain = null): SitemapHandleInterface
    {
        return new SitemapHandle($filesystem$context$this->eventDispatcher, $domain);
    }
}

        $url = new Url();
        $url->setLoc('https://shopware.com');
        $url->setLastmod(new \DateTime());
        $url->setChangefreq('weekly');
        $url->setResource(CategoryEntity::class);
        $url->setIdentifier(Uuid::randomHex());

        $fileSystem = $this->createMock(Filesystem::class);
        $fileSystem->expects(static::never())->method('write');

        $this->handle = new SitemapHandle(
            $fileSystem,
            $this->getContext(),
            $this->getContainer()->get('event_dispatcher')
        );

        $this->handle->write([
            $url,
        ]);
    }

    public function testWrite(): void
    {
Home | Imprint | This part of the site doesn't use cookies.