Working state
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user