File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
lib/internal/Magento/Framework/File Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ public function getMimeType($file)
115
115
116
116
$ mimeType = '' ;
117
117
if ($ driver instanceof Filesystem \DriverInterface) {
118
- $ mimeType = $ driver ->getMetadata ($ file )['mimetype ' ];
118
+ $ mimeType = $ driver ->getMetadata ($ file )['mimetype ' ] ?? '' ;
119
119
}
120
120
121
121
if (!$ mimeType ) {
Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ public function testGetMimeTypeNonexistentFileException(): void
83
83
->method ('isExists ' )
84
84
->with ('nonexistent.file ' )
85
85
->willReturn (true );
86
-
86
+ $ this ->localDriverMock ->method ('getMetadata ' )
87
+ ->willThrowException (new FileSystemException (__ ('File \'nonexistent.file \' doesn \'t exist ' )));
87
88
$ file = 'nonexistent.file ' ;
88
89
$ this ->object ->getMimeType ($ file );
89
90
}
@@ -103,7 +104,8 @@ public function testGetMimeType($file, $expectedType): void
103
104
->method ('isExists ' )
104
105
->with ($ file )
105
106
->willReturn (true );
106
-
107
+ $ this ->localDriverMock ->method ('getMetadata ' )
108
+ ->willReturn (['mimetype ' => $ expectedType ]);
107
109
$ actualType = $ this ->object ->getMimeType ($ file );
108
110
self ::assertSame ($ expectedType , $ actualType );
109
111
}
You can’t perform that action at this time.
0 commit comments