1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-31 01:29:51 +02:00

Pass mime type manually to avoid finfo dependency

This commit is contained in:
Oliver Vogel
2024-10-06 16:37:26 +02:00
parent a09c7c9c33
commit 8cf0405a9a
19 changed files with 32 additions and 34 deletions

View File

@@ -105,10 +105,11 @@ abstract class BaseTestCase extends MockeryTestCase
protected function assertMediaType(string|array $allowed, string|EncodedImage $input): void
{
$detected = match (true) {
is_string($input) => (new EncodedImage($input))->mimetype(),
default => $input->mimetype(),
};
$pointer = fopen('php://temp', 'rw');
fputs($pointer, (string) $input);
rewind($pointer);
$detected = mime_content_type($pointer);
fclose($pointer);
$allowed = is_string($allowed) ? [$allowed] : $allowed;
$this->assertTrue(in_array($detected, $allowed));