Working state
This commit is contained in:
@@ -63,6 +63,32 @@ final class MediaControllerUploadCompatibilityTest extends ControllerTestCase
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function testUploadPrefersFileFieldWhenBothFileAndImageArePresent(): void
|
||||
{
|
||||
$fileField = $this->makeValidUploadedFile();
|
||||
$imageField = $this->makeValidUploadedFile();
|
||||
|
||||
$this->sessionManager->method('getUserId')->willReturn(11);
|
||||
$this->mediaService->expects($this->once())
|
||||
->method('store')
|
||||
->with($fileField, 11)
|
||||
->willReturn('/media/preferred-file-field.webp');
|
||||
|
||||
$req = $this->makePost('/admin/media/upload')->withUploadedFiles([
|
||||
'file' => $fileField,
|
||||
'image' => $imageField,
|
||||
]);
|
||||
$res = $this->controller->upload($req, $this->makeResponse());
|
||||
|
||||
$this->assertStatus($res, 200);
|
||||
$this->assertJsonContains($res, [
|
||||
'success' => true,
|
||||
'url' => '/media/preferred-file-field.webp',
|
||||
'file' => '/media/preferred-file-field.webp',
|
||||
]);
|
||||
}
|
||||
|
||||
public function testUploadSuccessResponseContainsBothUrlAndFileKeys(): void
|
||||
{
|
||||
$file = $this->makeValidUploadedFile();
|
||||
|
||||
Reference in New Issue
Block a user