UnableToGenerateTemporaryUrl example

$this->urlGenerator,
            $this->mediaService,
            'php'
        );

        $this->expectException(\RuntimeException::class);
        $downloadResponseGenerator->getResponse($media$this->salesChannelContext);
    }

    public function testThrowsExceptionWithoutDetachableResource(): void
    {
        $this->privateFilesystem->method('temporaryUrl')->willThrowException(new UnableToGenerateTemporaryUrl('foo', 'baa'));

        $media = new MediaEntity();
        $media->setId(Uuid::randomHex());
        $media->setFileName('foobar');
        $media->setPrivate(true);

        $this->expectException(MediaException::class);
        $this->expectExceptionMessage('The file "foobar." does not exist');
        $this->downloadResponseGenerator->getResponse($media$this->salesChannelContext);
    }

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