$media =
new MediaEntity();
if ($file) { $media->
setFileName($file);
} if ($ext) { $media->
setFileExtension($ext);
} static::
assertEquals($expected,
$media->
getFileNameIncludingExtension());
} /**
* @return array<string, array{file: ?string, ext: ?string, expected: ?string}>
*/
public static function filenameExtensionProvider(): array
{ return [ 'only-ext' =>
['file' => null, 'ext' => 'jpg', 'expected' => null
],
'only-file' =>
['file' => 'Tuscany-Landscape', 'ext' => null, 'expected' => null
],
'file-and-ext' =>
['file' => 'Tuscany-Landscape', 'ext' => 'jpg', 'expected' => 'Tuscany-Landscape.jpg'
],
];