DownloadResponseGenerator example

private MockObject&SalesChannelContext $salesChannelContext;

    protected function setUp(): void
    {
        $this->mediaService = $this->createMock(MediaService::class);
        $this->privateFilesystem = $this->createMock(Filesystem::class);
        $publicFilesystem = $this->createMock(Filesystem::class);
        $this->urlGenerator = $this->createMock(UrlGeneratorInterface::class);
        $this->urlGenerator->method('getAbsoluteMediaUrl')->willReturn('foobar.txt');
        $this->urlGenerator->method('getRelativeMediaUrl')->willReturn('foobar.txt');

        $this->downloadResponseGenerator = new DownloadResponseGenerator(
            $publicFilesystem,
            $this->privateFilesystem,
            $this->urlGenerator,
            $this->mediaService,
            'php'
        );

        $this->salesChannelContext = $this->createMock(SalesChannelContext::class);
        $this->salesChannelContext->method('getContext')->willReturn(Context::createDefaultContext());
    }

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