createMock(MediaRepositoryInterface::class); $file = $this->createMock(UploadedFileInterface::class); $file->method('getSize')->willReturn(null); $service = new MediaService($repo, '/tmp', '/media', 1000); $this->expectException(StorageException::class); $service->store($file, 1); } public function testRejectsWhenFileTooLarge(): void { $repo = $this->createMock(MediaRepositoryInterface::class); $stream = $this->createMock(StreamInterface::class); $stream->method('getMetadata')->willReturn('/tmp/file'); $file = $this->createMock(UploadedFileInterface::class); $file->method('getSize')->willReturn(999999); $file->method('getStream')->willReturn($stream); $service = new MediaService($repo, '/tmp', '/media', 100); $this->expectException(FileTooLargeException::class); $service->store($file, 1); } }