Working state

This commit is contained in:
julien
2026-03-16 13:40:18 +01:00
parent dec76fa2c7
commit 557360dfde
57 changed files with 1044 additions and 1668 deletions

View File

@@ -6,17 +6,18 @@ namespace Tests\Media;
use App\Media\Exception\InvalidMimeTypeException;
use App\Media\MediaRepositoryInterface;
use App\Media\MediaService;
use App\Post\PostRepositoryInterface;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\UploadedFileInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UploadedFileInterface;
#[\PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations]
final class MediaServiceInvalidMimeTest extends TestCase
{
public function testRejectsNonImageContentEvenWithImageLikeFilename(): void
{
$repo = $this->createMock(MediaRepositoryInterface::class);
$postRepo = $this->createMock(PostRepositoryInterface::class);
$tmpFile = tempnam(sys_get_temp_dir(), 'upload_');
self::assertNotFalse($tmpFile);
@@ -30,7 +31,7 @@ final class MediaServiceInvalidMimeTest extends TestCase
$file->method('getStream')->willReturn($stream);
$file->method('getClientFilename')->willReturn('photo.png');
$service = new MediaService($repo, sys_get_temp_dir(), '/media', 500000);
$service = new MediaService($repo, $postRepo, sys_get_temp_dir(), '/media', 500000);
try {
$this->expectException(InvalidMimeTypeException::class);