Skip to content

Commit

Permalink
add test #1971
Browse files Browse the repository at this point in the history
  • Loading branch information
hmeneuvrier committed May 15, 2024
1 parent 61d2307 commit c9b9872
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/Functional/Service/UploadHandlerServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,30 @@ public function testUploadBigFileShouldThrowsException(): void
$uploadHandlerService->uploadFromFile($uploadedFileMock, 'test.png');
}

public function testUploadVideoFileShouldThrowsException(): void
{
/** @var ParameterBagInterface $parameterBag */
$parameterBag = static::getContainer()->get(ParameterBagInterface::class);

$uploadHandlerService = new UploadHandlerService(
$this->createMock(FilesystemOperator::class),
$parameterBag,
$this->createMock(LoggerInterface::class),
$this->createMock(HeicToJpegConverter::class),
$this->createMock(FilenameGenerator::class),
);

$uploadedFileMock = $this->createMock(UploadedFile::class);
$uploadedFileMock
->expects($this->atLeast(1))
->method('getMimeType')
->willReturn('video/webm');

$this->expectException(\Exception::class);
$this->expectExceptionMessage('Le format video/webm n\'est pas supporté, merci d\'essayer avec un format jpeg,jpg,png,gif,pdf,docx,odt,doc,txt,xls,xlsx');
$uploadHandlerService->uploadFromFile($uploadedFileMock, 'test.webm');
}

public function testUploadToTempFolderThrowException(): void
{
$uploadFile = new UploadedFile(
Expand Down

0 comments on commit c9b9872

Please sign in to comment.